lecture-2 - CPSC 324 Topics in Java Programming Lecture 2...

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

View Full Document Right Arrow Icon
1/14/10 1 CPSC 324 Topics in Java Programming Lecture 2: Basic Java Programming Constructs Today … More on basic language constructs primitive types, variables, operators, control fow Reading Assignments Core : Ch. 3: 35 – 49, 51 – 52, 71 - 92 Style : Ch. 3 – 4 Homework Assignment #1 Due: Thursday, January 28 th (2 weeks) 2 CPSC 324 ‐‐ Spring 2010
Background image of page 1

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

View Full Document Right Arrow Icon
1/14/10 2 Announcement We have a new room! Paccar 210 Across form the Engineering ofFce Next Tuesday we’ll meet in this room This is a lab classroom Computers on each desk Java not installed in the lab :( But, will try to get it installed w/ an editor CPSC 324 ‐‐ Spring 2010 3 Challenge question What is the signature for a Java main method? Answer: public static void main string bracket bracket args CPSC 324 ‐‐ Spring 2010 4
Background image of page 2
1/14/10 3 (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main(String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 5 We will talk more about classes later. For now you just need to know the basic syntax to start writing your own programs. (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main(String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 6 We are defining a class called “MyFirstApp” There must be one of these in each file
Background image of page 3

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

View Full Document Right Arrow Icon
1/14/10 4 (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main (String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 7 MyFirstApp has a single method (in this case the special “main” method) (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main(String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 8 the return type of the method (void means no return value)
Background image of page 4
1/14/10 5 (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main(String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 9 we will cover this later (like static member functions in C++) (Beginning) Anatomy of a Class Every Java application has to have: At least one class At least one main method (not per class, just in the app) public class MyFirstApp { public static void main (String[] args) { System.out.println(“Java Rules!”); } } CPSC 324 ‐‐ Spring 2010 10 The formal arguments to the method (an array of String objects called ‘args’)
Background image of page 5

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

View Full Document Right Arrow Icon
1/14/10 6 (Beginning) Anatomy of a Class
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 27

lecture-2 - CPSC 324 Topics in Java Programming Lecture 2...

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

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