Lec3 Java Eclipse

Lec3 Java Eclipse - Lecture 3 Announcements EE422C Data...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 EE422C Data Structures Sarfraz Khurshid Lecture 3 Sep 2, 2010 Lecture 3 Announcements Topics so far • course intro • software engineering and where data structures fit • Java and Eclipse intro Today 2 • more on basics of Java and Eclipse Next time • flow-charts, references, and strings • Assignment 1 goes out • Read it before coming to class JAVA vs. C/C++ Overview of Main Differences Good Java Sources are: http://java.sun.com/j2se/1.5.0/docs/api/index.html http://java.sun.com/docs/books/tutorial/ Hello World in C #include <stdio.h> int main( ) { printf(“Hello World\n”); return (0); } 4 Hello World in C++ #include <iostream> using namespace std; int main( ) { cout << “Hello World” << endl; 5 return (0); } Hello World in Java public class GreetingsToYou { public static void main (String[ ] args) { System.out.println (“Hello World”); } 6 }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Basic Language Constructs Java has an additional basic data type: • boolean There’s no goto in Java • The one unconditional jump mechanism is the break label or continue label, which can be used to jump out of the middle of multiply nested loops 7 of the middle of multiply-nested loops Java has method overloading, but no operator overloading Parameter passing: Call by value Java has applets (constrained programs for downloading from the web) Portability Java is (an interpreted) write once, run anywhere language • Uses a virtual machine concept • Write once, run everywhere (nearly) doesn‘t work with C/C++ • The biggest potential stumbling block is speed: interpreted Java runs slower than C 8 interpreted Java runs slower than C But: nothing prevents the Java language from being compiled and there are just-in-time (JIT) compilers that offer significant speed-ups Program Organization Java has no preprocessor • If you want to use classes in another library, you say “import“ and the name of the library • There is no conditional compiling (#ifdef) You don't have separate HEADER-files 9 You can define elements within a class or an interface • All method definitions are defined in the body of a
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2010 for the course EE 322C taught by Professor Nettles during the Spring '08 term at University of Texas.

Page1 / 5

Lec3 Java Eclipse - Lecture 3 Announcements EE422C Data...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online