int k = Integer.MAX_VALUE; k++; int k = Integer.MAX_VALUE; k++; What happens when the following code executes? byte b = someFile.readByte(); b = (byte)(b >>> 2); //shift bit string right by two bits byte b = someFile.readByte(); b = (byte)(b >>> 2); //shift bit string right by two bits Suppose that the byte read is the bit string What is the value of b after executing the following?
public class Child extends Parent {... // the following is an invalid instruction super.super.foo();... } public class Child extends Parent {... // the following is an invalid instruction super.super.foo();... } Suppose the Grandparent class contains a parameterless void method named foo, that is overridden by a Parent subclass which in turn is overridden by its Child subclass. Within the Child class how can you call the Grandparent version of foo ? public class Example { E generic object = ? } public class Example { E generic object = ? } How do you create an object of generic type? Grandparent + void foo() Parent + void foo() Child + void foo()
CS/421 is not a programming course! CS/421 is not a survey of languages course!
Classification by “Power” machine language - a program instruction is a number - programs are “understood” by computer hardware assembler language - a program instruction is a mnemonic version of the corresponding machine instruction high-level language - language constructs are designed with the programmer in mind parallel language - a program is a group of tasks that execute simultaneously
Classification by Intended Application general purpose … e.g. PL/1 scientific/engineering applications … e.g. FORTRAN business applications … e.g.s COBOL, RPG systems programming … e.g.s C, PL/S, Bliss real time systems … e.g.s Ada, Jovial list processing … e.g.s LISP, SLIP, Scheme string processing … e.g.s Snobol, Icon set processing … e.g. SETL Web applications … e.g. Java script programming … e.g.s Perl, PHP, Javascript
“Classification” by User Interface compiled Each program (the source code) must be translated into machine language form for execution. interpreted The source code instructions are analyzed individually as they are executed.
Classification by Paradigm imperative / procedural programming program = sequence of instructions (usually including loops & procedures) variables & assignments used liberally key control structure: repetition (while/for) key data structure: array examples: Ada, C, Cobol, FORTRAN, Pascal, PL/1 functional / applicative programming program = a function to be evaluated key control structure: recursion key data structure: list examples: LISP, Scheme, ml
Classification by Paradigm (continued) object-oriented programming program = sequence of operations (methods) applied to objects an object incorporates both data and associated operations examples: Smalltalk, Eiffel, Java, C# logic-based / relational programming program = a collection of rules and goals program execution is based on theorem proving concepts example: Prolog
languageyearauthor(s)intended purpose FORTRAN1957J. Backus/IBMscientific LISP1958McCarthy (MIT)list processing (A.I.) ALGOL 58/ Intn’l committeegeneral COBOL1959Hopper/committeebusiness D.P. APL1960 Iverson/Harvard/IBMmatrices/scientific SNOBOL1962Griswold/Bell Labsstring processing BASIC1963Kemeny & Kurtzeducation PL/11963SHARE Com./IBMgeneral Simula1963Dahl et. al.general/simulation ALGOL Intn’l committeegeneral Bliss1971Wulf/CMUsystems programming Pascal1971Wirth/ETH-Zurichgeneral/education Prolog1972Colmerauer/Kowalskilogic-based (A.I.)
languageyearauthor(s)intended purpose C1972Ritchie/Bell Labssystems programming Conc.Pascal1975Hansen/CA-Techparallel programming Scheme1975 Steele/Sussman/MITlists/A.I. Euclid1977Committeeverifiable prog. Gypsy1977U of TXverifiable prog. Modula-21977Wirth/ETHgeneral ML1978Milner/EdinburghMachine-assisted proof Ada1979DOD committeereal-time Smalltalk1980Kay/Xerox PARCobject-oriented C++1986Stroustrup/Bell Labsobject-oriented C Eiffel1990Bertrand Meyerobject-oriented Java1994Gosling/SunWeb/object-oriented C#2001Microsoftbasis for.net