L03 - Computer Science 1 1 SS C Lecture 3 Contents! 2!...

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

View Full Document Right Arrow Icon
CS101 Lecture 3 1 Computer Science 1 1 SS C Lecture 3 Contents Java Syntax Displaying Output Coursebook: §2, §3 2 Review public class MyProgram { public void start() { System.out.println("Hello World"); } } public class MyApplication { public static void main(String[] args) { MyProgram p = new MyProgram (); p.start(); } } Write the source code for the application (which starts the program). MyProgram .java MyApplication .java instructions which will be executed Write the source code for the program: 3 During lectures We will only look at the program fle: When we want to write a diFFerent program, we will defne diFFerent instructions public class MyProgram { } public void start() { } System.out.println("Hello World"); 4 Java Syntax We need to learn: We must be very precise when writing our code The compiler is very picky • the combinations oF words and symbols that are allowed • the punctuation and symbols that are required • the words which have special meaning List of reserved words is On page 19 of the course book. 5 Errors You will make mistakes – don't worry, this helps you learn. • logic errors • runtime errors • syntax errors There are three types of errors: 6 Style We are writing our programs For two diFFerent audiences: This course, pays particular attention to indentation, identifers and comments . To improve consistency and readability: http:// www.oracle.com / technetwork /java/codeconvtoc-136057.html • the computer • other people • all programmers should Follow the same conventions For the layout and organisation oF their code ±or the Java language, the document "Code Conventions For the Java Programming Language" describes these style guidelines:
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS101 Lecture 3 2 7 Code conventions http:// www.oracle.com / technetwork /java/codeconvtoc-136057.html
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 03/01/2012 for the course COMPSCI 101 taught by Professor Adrianaferraro during the Summer '12 term at Auckland.

Page1 / 5

L03 - Computer Science 1 1 SS C Lecture 3 Contents! 2!...

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