Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pre-Sessional Java Programming Lecture 1a Reyer Zwiggelaar

Similar presentations


Presentation on theme: "Pre-Sessional Java Programming Lecture 1a Reyer Zwiggelaar"— Presentation transcript:

1 Pre-Sessional Java Programming Lecture 1a Reyer Zwiggelaar rz@sys.uea.ac.uk

2 Aims To give non-programmers confidence –Particularly written for this group so no prior knowledge expected Conversion from other languages to Java –Close links with C++

3 Structure Two weeks: 9-19/09/02 Mornings 10:00 - 12:00 Lectures –SCI 0.31 & SCI 3.05 Afternoons 13:00-15:00 Labs Group A/B/C –NT1, NT2, NT5 Afternoons 15:00-17:00 Labs Group D/E –NT1, NT2

4 Who’s Doing What Lectures –Steve Hordley: sh@sys.uea.ac.uk –Reyer Zwiggelaar: rz@sys.uea.ac.uk Lab Sessions –Lilian Blot, Yanong Zhu, Paul Southam, Daan Zhu, Alex Palmer, Ling Ma, Guoying Qi, Ruiting Liu, Judy Tryggvason, Min Chen

5 Week One

6 Any Questions These come up after important points in a lecture If there are no questions I will assume you all have understood it so far So, any questions….

7 Week Two

8 Assessment Aspects Zero rated unit Two exercises from each lab-session –Printed on paper –Handed in to SYS Admin Office (or in mailbox if set up) –One exercise from each lab-session selected (at random) and marked

9 What Will We Use The pre-sessional course –JDK/SDK 1.4.0 –Simple text editor MA23/MA15 –The same as above –Or an IDE (Integrated Development Environment)

10 Books and Documentation There are lots of books out there –Bruce Eckell: Thinking in Java (which is freely available on the web) –Jan Skansholm: Java From the Beginning –O’Reilly Books: Java in a Nutshell –Pooley and Stevens: Using UML www.java.com The lecture notes

11 Any Questions

12 Computers and Programs Memory Program Input Output Computer

13 Files, Directories and Disks Information is stored on “Hard Disks” Disks contain Directories (and Files) Directories contain Files (and Directories) Tree Structure –Windows Explorer

14 Simple Software Engineering Source Code CompilationMachine Readable Code Execution

15 Simple Software Engineering Define the problem Outline the solution Develop the outline into an algorithm Test the algorithm for correctness Code the algorithm Execute the program Document and maintain the program

16 Simple Software Engineering How many students are there in this class?

17 Object Oriented SE An attempt to model the real world The data determines the object/classes Short introduction here –More details in second week

18 Object Oriented SE A class gives a description of a real world object Data and methods –Data describes what the object is –Methods describes what the object can do

19 Object Oriented SE Obtain an English language description The nouns indicate objects Associate all attributes (data) with the objects Operations (methods) are identified by verbs associated with the objects

20 Object Oriented SE How many students are there in this class?

21 Any Questions

22 Short break of 10 minutes

23 Hello World First Java program No input (initially) Output “Hello World” on the screen

24 Opening a DOS Window Moving about –“cd” stands for “change directory” “cd java” will move to a directory named “java” (that is if there is a directory named “java”) “cd..” will go one directory up (if you are not already at the top directory) –“dir” will give directory listing

25 Text Editing Type: edit HelloWorld.java –Within the DOS window you can now edit the file HelloWorld.java

26 Entering Text - 1 class HelloWorld { }

27 Any Questions

28 Entering Text - 2 class HelloWorld { public static void main(String[] args) { }

29 Any Questions

30 Entering Text - 3 class HelloWorld { public static void main(String[] args) { System.out.println(“Hello …. World”); }

31 Any Questions

32 Entering Comments //file: HelloWorld.java /* An application that prints the message “Hello …. World” on the screen */ class HelloWorld { public static void main(String[] args) { System.out.println(“Hello …. World”); }

33 Any Questions

34 Program Layout - Not Like This class HelloWorld { public static void main(String[] args) { System.out.println(“Hello …. World”); }

35 Program Layout - Not Like This class HelloWorld { public static void main(String[] args) { System.out.println(“Hello …. World”); } }

36 Saving the Program File -> Exit –Will ask if you want to save: Yes File -> Save and File -> Exit

37 Compiling a Program Type: javac HelloWorld.java –javac is the Java compiler If there are no compiler errors than no messages will appear and a file called HelloWorld.class will be created –Type: dir

38 Executing a Program Type: java HelloWorld Should produce: “Hello …. World” on the screen

39 Any Questions

40 Introducing Mistakes - 1 class HelloWorld { public static void main(String[] args) System.out.println(“Hello …. World”); }

41 Introducing Mistakes - 2 class HelloWorld { public static void main String[] args) { System.out.println(“Hello …. World”); }

42 Introducing Mistakes - 3 class HelloWorld { public static void main(String[] args) { System.out.println(“Hello …. World”) }

43 Introducing Mistakes - 4 class HelloWorld { public void main(String[] args) { System.out.println(“Hello …. World”); }

44 Any Questions

45 Hello Second Java program With input Output “Hello ????” on the screen –Where ???? stands for an argument when executing the program, e.g. java Hello ????

46 Adapting First Program class Hello { public static void main(String[] args) { System.out.println(“Hello ”+args[0]); }

47 Any Questions

48 Lab Groups –13:00-15:00 A-NT1/B-NT2/C-NT5 –15:00-17:00 D-NT1/E-NT2

49 End of the Lecture


Download ppt "Pre-Sessional Java Programming Lecture 1a Reyer Zwiggelaar"

Similar presentations


Ads by Google