Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1 Primitive Java. import java.io.*; /* an example program */ public class Example1 { public static void main (String[] args) { System.out.println("Hello.

Similar presentations


Presentation on theme: "Chapter 1 Primitive Java. import java.io.*; /* an example program */ public class Example1 { public static void main (String[] args) { System.out.println("Hello."— Presentation transcript:

1 Chapter 1 Primitive Java

2 import java.io.*; /* an example program */ public class Example1 { public static void main (String[] args) { System.out.println("Hello World!"); }

3 Jargon and Syntax Review zclass - data fields and methods that describe the state and behavior of an object zmethod - a section of code that provides behavior for an object zcomments - notes to programmers that are ignored by the compiler. /* */ and //

4 Identifiers za name we make up zmust start with a letter zfollowed by any combination of letters, digits, and some “special” characters zcan not be a keyword zshould be meaningful

5 Primitive Types zbyte zshort zint zlong z float z double z char z boolean

6 Typed Constants zType determined by compiler

7 Reference Types zAll non-primitive types zstores a “reference” to a memory address where the object is located

8 Declarations int i; String s; long size = 5; String name = “George”;

9 OPERATORS assignment= compound assignment+= *= etc. binary arithmetic+ - / % unary++ -- binary relational== > = <= logical&& || !

10 Control Structures zSequence zSelection zRepetition

11 Some Loop Patterns zRead/process loop zSentinel controlled loop zCounted loop

12 Creating a Loop é Initialization é Termination é Body


Download ppt "Chapter 1 Primitive Java. import java.io.*; /* an example program */ public class Example1 { public static void main (String[] args) { System.out.println("Hello."

Similar presentations


Ads by Google