100 likes | 275 Views
How much do you know about Java?. What happens when the following code executes?. int k = Integer.MAX_VALUE; k++;. Suppose that the byte read is the bit string 10000000 What is the value of b after executing the following?. byte b = someFile.readByte();
E N D
How much do you know about Java? What happens when the following code executes? int k = Integer.MAX_VALUE; k++; Suppose that the byte read is the bit string 10000000 What is the value of b after executing the following? byte b = someFile.readByte(); b = (byte)(b >>> 2); //shift bit string right by two bits
How much more do you know about Java? Suppose the Grandparent class contains a parameterless void method named foo, that is overridden by a Parent subclass which in turn s overridden by its Child subclass. Within the Child class how can you call the Grandparent version of foo? public class Child extends Parent { . . . // the following is an invalid instruction super.super.foo(); . . . } How do you create an object of generic type? public class Example<E> { E generic object = ? }
What is a programming language? CS/421 is not a programming course! CS/421 is not a survey of languages course!
Classification of Programming Languages 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 of Programming Languages 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 of Programming Languages “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 of Programming Languages 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 of Programming Languages 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
History language year author(s) intended purpose FORTRAN 1957 J. Backus/IBM scientific LISP 1958 McCarthy (MIT) list processing (A.I.) ALGOL 58/60 1958 Intn’l committee general COBOL 1959 Hopper/committee business D.P. APL 1960 Iverson/Harvard/IBM matrices/scientific SNOBOL 1962 Griswold/Bell Labs string processing BASIC 1963 Kemeny & Kurtz education PL/1 1963 SHARE Com./IBM general Simula 1963 Dahl et. al. general/simulation ALGOL 68 1967 Intn’l committee general Bliss 1971 Wulf/CMU systems programming Pascal 1971 Wirth/ETH-Zurich general/education Prolog 1972 Colmerauer/Kowalski logic-based (A.I.)
History language year author(s) intended purpose C 1972 Ritchie/Bell Labs systems programming Conc.Pascal 1975 Hansen/CA-Tech parallel programming Scheme 1975 Steele/Sussman/MIT lists/A.I. Euclid 1977 Committee verifiable prog. Gypsy 1977 U of TX verifiable prog. Modula-2 1977 Wirth/ETH general ML 1978 Milner/Edinburgh Machine-assisted proof Ada 1979 DOD committee real-time Smalltalk 1980 Kay/Xerox PARC object-oriented C++ 1986 Stroustrup/Bell Labs object-oriented C Eiffel 1990 Bertrand Meyer object-oriented Java 1994 Gosling/Sun Web/object-oriented C# 2001 Microsoft basis for .net