presentation6 - Java Basic Programming Constructs Soheil...

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

View Full Document Right Arrow Icon
Java Basic Programming Constructs Soheil Hassas Yeganeh Computer Engineering Department Sharif University of Technology
Background image of page 1

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

View Full DocumentRight Arrow Icon
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } }
Background image of page 2
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } } This is a comment!
Background image of page 3

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

View Full DocumentRight Arrow Icon
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } } This is a class named “HelloWorld”.
Background image of page 4
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } } The main function of your program.
Background image of page 5

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

View Full DocumentRight Arrow Icon
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } } The arguments of the program.
Background image of page 6
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } } Output statement of your program.
Background image of page 7

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

View Full DocumentRight Arrow Icon
A Closer Look at HelloWorld 2 /* * This is your first java program. */ class HelloWorld { public static void main(String[] args){ System.out.println(“Hello World!”); } }
Background image of page 8
Programming Constructs 3
Background image of page 9

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

View Full DocumentRight Arrow Icon
Programming Constructs 3 2 Categories of Programming Constructs Data Types Control Flow if then else while goto break array pointer expression operator variable function object input/output
Background image of page 10
Another Example 4 /* * This is your second java program. */ class AnotherExample { public static void main(String[] args){ int i = 20; System.out.println("The i is : " + i); i = i * i; System.out.print("The i ^ 2 is : "); System.out.println(i); } }
Background image of page 11

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

View Full DocumentRight Arrow Icon
Another Closer Look! 5 /* * This is your second java program. */ class AnotherExample { public static void main(String[] args){ int i = 20; System.out.println("The i is : " + i); i = i * i; System.out.print("The i ^ 2 is : "); System.out.println(i); } }
Background image of page 12
5 /* * This is your second java program. */ class AnotherExample { public static void main(String[] args){ int i = 20; System.out.println("The i is : " + i); i = i * i; System.out.print("The i ^ 2 is : "); System.out.println(i); } } A variable is defned as integer. Its name is “i”.
Background image of page 13

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

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/21/2010 for the course COMPUTER S 003 taught by Professor Izadi during the Spring '10 term at Amirkabir University of Technology.

Page1 / 68

presentation6 - Java Basic Programming Constructs Soheil...

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

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