Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1

2 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 10000000 What is the value of b after executing the following?

3 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()

4 CS/421 is not a programming course! CS/421 is not a survey of languages course!

5 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

6 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

7 “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.

8 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

9 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

10 languageyearauthor(s)intended purpose FORTRAN1957J. Backus/IBMscientific LISP1958McCarthy (MIT)list processing (A.I.) ALGOL 58/60 1958Intn’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 681967Intn’l committeegeneral Bliss1971Wulf/CMUsystems programming Pascal1971Wirth/ETH-Zurichgeneral/education Prolog1972Colmerauer/Kowalskilogic-based (A.I.)

11 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


Download ppt "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."

Similar presentations


Ads by Google