Download as pdf or txt
Download as pdf or txt
You are on page 1of 105

Programming

Fundamentals

Java Boot Camp


Module 1

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Objectives
 At the end of the lesson, the student
should be able to:
 Identify the basic parts of a Java program
 Differentiate among Java literals, primitive
data types, variable types ,identifiers and
operators
 Develop a simple valid Java program using
the concepts learned in this chapter

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 indicates the name of the class which is SampleOne


 In Java, all code should be placed inside a class
declaration
 The class uses an access specifier public, which indicates
that our class in accessible to other classes from other
packages (packages are a collection of classes). We will be
covering packages and access specifiers later.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 The curly brace { indicates the start of a block.


 There should be a corresponding closing curly
brace }to end the block.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 The next three lines are a Java comment.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 The main method is the starting point of a Java


program.
 Make sure to follow the exact signature and note that it
has a closing curly brace.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 The next line is another Java comment, a single-


line comment.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Dissecting my First Java
Program

 The command System.out.println(), prints


the text enclosed by quotation on the screen.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Best Practices
 Your Java programs should always end with the .java
extension.
 Filenames should match the name of your public
class. So for example, if the name of your public class
is Hello, you should save it in a file called
Hello.java.
 You should write comments in your code explaining
what a certain class does, or what a certain method
do.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Comments
 Comments
 These are notes written to a code for documentation
purposes.
 These notes are not part of the program and do not
affect the flow of the program.
 3 Types of comments in Java
 C++ Style Comments
 C Style Comments
 Javadoc Comments

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Comments
 C++-Style Comments
 C++ Style comments start with //
 All the text after // is treated as a comment
 For example:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Comments
 C-Style Comments
 C-style comments, also called multiline
comments start with a /* and end with a */.
 All text in between the two delimiters is
treated as a comment.
 Unlike C++ style comments, it can span
multiple lines.
 For example:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Comments
 Javadoc Comments
 Javadoc comments are used for generating
HTML documentation for your Java programs.
 You can create javadoc comments by starting
the line with /** and ending it with */.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Statements
 Statement
 one or more lines of code terminated by a
semicolon.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Blocks
 Block
 is one or more statements bounded by
opening and closing curly braces that group
the statements as one unit.
 Block statements can be nested indefinitely.
 Any amount of whitespace is allowed.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Statements and Blocks
Best Practice
 You should indent block-enclosed
statements four spaces after the start of a
block. For example:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Identifiers
 Identifiers
 are tokens that represent names of variables,
methods, classes, and other user-defined
program elements.
 Examples of identifiers are: Hello, main,
System, out.
 Java identifiers are case-sensitive.
 This means that the identifier Hello is not the
same as hello.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Identifiers
 Identifiers must begin with either a letter,
an underscore “_”, or a dollar sign “$”.
Letters may be lower or upper case.
Subsequent characters may use numbers
0 to 9.
 Identifiers cannot use Java keywords like
class, public, void, etc. We will discuss
more about Java keywords later.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Identifiers
Best Practices
 For names of classes, capitalize the first letter of the
identifier. For example:
 ThisIsAnExampleOfClassName

 For names of methods and variables, the identifier


should start with a lower-case letter. For example:
 thisIsAnExampleOfMethodName

 When creating multi-word identifiers, use capital


letters to indicate the start of each word except the
first word. For example,
 charArray, fileNumber, ClassName.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Identifiers
Best Practices
 For constants use all capitals and separate words with
underscores. For example:
 EXAMPLE_OF_A_CONSTANT
 Avoid using underscores at the start of the identifier
such as _read or _write.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Keywords
 Keywords are predefined identifiers
reserved by Java for specific purposes.
 You cannot use keywords as identifiers
for any user-defined elements such as
variables, methods, classes, and
constants.
 The next slide contains the list of the Java
Keywords.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Keywords

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Java Literals
 Literals are tokens that do not change -
they are constant.
 The different types of literals in Java are:
 Integer Literals
 Floating-Point Literals
 Boolean Literals
 Character Literals
 String Literals

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types
 The Java programming language defines eight
primitive data types.
 Logical
 boolean
 Textual
 char
 Numerical
 byte
 short
 int
 long (integral)
 double
 float (floating point).

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types:
Logical-boolean
 A boolean data type represents one of two
states: true and false.
 An example is

 The example declares a boolean type


variable named result and assigns it a
value of true.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types:
Textual-char
 A character data type (char), represents a
single Unicode character.
 It must have its literal enclosed in single
quotes(’’).

 To represent special characters like ' (single


quotes) or " (double quotes), use the escape
character \.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types:
Textual-char
 The following literals all refer to the same
character:

Hexadecimal

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types:
Textual-char
 String is not a primitive data type, but due to its
very common use we will introduce String in this
section.
 A String is a data type composed of multiple
characters. As such it is not a primitive data type,
it is a class.
 It has its literals enclosed in double quotes(“ ”).

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types: Integral –
byte, short, int & long
 Integral data types have the following ranges:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types: Integral –
byte, short, int & long
 Integral data types in Java can take values
in three forms – decimal, octal or
hexadecimal.

Integral types have int as default data


type.
 You can define a long value by appending
the letter l or L (upper or lowercase 'L')

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types: Floating
Point – float and double
 Floating-point data types have the
following specs:
type bits accuracy range represented (approximate only)
float 32 6 to 7 significant digits ±1.40e-45 to ±3.40e+38
double 64 14 to15 significant digits ±4.94e-324 to ±1.79e+308

 Though floating-point data types can


represent the exact value of some
integers, as a general practice we never
regard floating-point representations as
exact.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Primitive Data Types: Floating-
Point – float and double
 Floating-point types have double as default data
type.
 Floating-point literals/constants include either a
decimal point or one of the following,
E or e //(add exponential value)
F or f //(float)
D or d //(double)
 Examples:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 Among integral types, casting is implicit if
from narrow to wide

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 Among integral types, casting is implicit if
from narrow to wide

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 Casting to a narrower datatype requires
an explicit cast. Initial bits will be
dropped.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 Similar rules apply to floating-point
primitives:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 Integral types can be implicitly cast to
floating-point types.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 If a floating-point is cast to an integral,
digits after the decimal-point are dropped:

 value of i: 4

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 char can be implicitly cast to int, long or
floating-point types

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Casting
 booleans cannot be cast to any other data
type

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Variables
 A variable is an item of data used to store
the state of objects.
 A variable has a:
 data type
 The data type determines the type of value that
the variable can hold.
 name
 The variable name must follow rules for identifiers.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Declaring and Initializing
Variables
 Declare a variable as follows:
 <data type> <name> [=initial value];
 Note: Values enclosed in < > are required
values, while those values in [ ] are
optional.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Declaring and Initializing
Variables: Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Declaring and Initializing
Variables: Best Practices
 It always good to initialize your variables
as you declare them.
 Use descriptive names for your variables.
For example, if you want a variable that
contains a student's grade, give it a name
like grade or englishGrade, and not just
random letters and/or numbers like g1.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Declaring and Initializing
Variables: Best Practice
 Declare one variable per line of code.
 For example, the variable declarations

are preferred over the declaration

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Scope of a Variable
 The scope
 determines where in the program a variable is
accessible.
 determines the lifetime of a variable or how long the
variable can exist in memory.
 The scope is determined by where the variable
declaration is placed in the program.

 To simplify, think of the scope as anything


between the curly braces {...}. Areas outside the
curly braces are called the outer blocks, and
blocks enclosed by the curly braces are called
inner blocks.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Scope of a Variable
 A variable's scope is
 Inside the block where it is declared, starting
from the point where it is declared, and in the
inner blocks.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example 1

C
D
E

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example 1
 The code we have here represents five scopes
indicated by the boxes and the letters
representing the scope.
 Given the variables i, j, k, m and n, and the five
scopes A, B, C, D and E, we have the following
scopes for each variable:
 The scope of variable i is A.
 The scope of variable j is B.
 The scope of variable k is C.
 The scope of variable m is D.
 The scope of variable n is E.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example 2

A
B

D
E

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example 2
 In the main method, the scopes of the
variables are,
 ages[] – scope A
 i in B – scope B
 i in C – scope C
 In the test method, the scopes of the
variables are,
 arr[] – scope D
 i in E – scope E

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Scope of a Variable
 When declaring variables, only one variable with
a given identifier or name can be declared in a
scope.
 That means that if you have the following
declaration,

your compiler will generate an error since you


should have unique names for each variable
within a single block.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Scope of a Variable
 However you can have two variables of
the same name if they are not declared in
the same block. For example,

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Outputting Variable Data
 In order to output the value of a certain
variable to console, we can use the
following commands:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Outputting Variable Data:
Sample Program

 The program will output the following text on


screen:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
System.out.println() vs.
System.out.print()
 System.out.println()
 Appends a newline at the end of the data
output
 System.out.print()
 Does not append newline at the end of the
data output

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
System.out.println() vs.
System.out.print()
 Program 1:

Output:

 Program 2:

Output:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Reference Variables vs.
Primitive Variables
 Two types of variables in Java:
 Primitive Variables
 Reference Variables
 Primitive Variables
 variables with primitive data types such as
int or long.
 stores data in the actual memory location of
where the variable is

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Reference Variables vs.
Primitive Variables
 Reference Variable
 a variable that stores the address in its
memory location
 points to another memory location where the
actual data is stored.
 When you declare a variable of a certain
class, you are actually declaring only a
reference to a possible instance of that class
(which might not exist yet), and are not
creating the object itself.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example
 Suppose we have two variables with data
types int and String.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Example
 The picture shown below is the actual
memory of your computer, wherein you
have the address of the memory cells, the
variable name and the data they hold.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Operators
 Different types of operators:
 arithmetic operators
 relational operators
 logical operators
 conditional operators
 These operators follow a precedence that
tells the compiler which operation to
evaluate first when multiple operators are
used in one statement.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators:
Sample Program Output

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Pop Quiz
 What is the result of writing this code:

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Pop Quiz
 What is the result of writing this code:

 Will not compile!

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators
 byte, short and char get automatically
promoted to int before any arithmetic
operation.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Arithmetic Operators
 In mixed expressions, all participants get
promoted to datatype of widest participant
 Floating point numbers are always
considered “wider” than integrals.

 all promoted to float

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Increment and Decrement
Operators
 unary increment operator (++)
 unary decrement operator (--)
 Increment and decrement operators increase
and decrease a value stored in a number
variable by 1.
 For example, the expression,

is equivalent to

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Increment and Decrement
Operators

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Increment and Decrement
Operators
 The increment and decrement operators
can be placed before or after an operand.
 When used before an operand, it causes
the variable to be incremented or
decremented by 1, and then the new value
is used in the expression in which it
appears.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Increment and Decrement
Operators
 When the increment and decrement
operators are placed after the operand,
the old value of the variable will be used in
the expression where it appears.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Increment and Decrement
Operators: Best Practice
 Always keep expressions containing
increment and decrement operators
simple and easy to understand.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Relational Operators
 Relational operators compare two values and
determines the relationship between those values.
 The output of evaluation are the boolean values
true or false.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Relational Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Relational Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Relational Operators:
Sample Program

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Relational Operators:
Sample Program Output

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators
 Logical operators have one or two
boolean operands that yield a boolean
result.
 There are six logical operators:
 && (short-circuit logical AND, binary)
 & (logical AND, binary)
 || (short-circuit logical OR, binary)
 | (logical inclusive OR, binary)
 ^ (logical exclusive OR, binary)
 ! (logical NOT, unary)

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators
 The basic expression for a logical
operation is,
x1 op x2
where,
x1, x2 - can be boolean expressions,
variables or constants
op - is either &&, &, ||, | or ^ operator.
 The truth tables that will be shown next,
summarize the result of each operation for
all possible combinations of x1 and x2.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: &&(logical)
and &(boolean logical) AND
 Here is the truth table for && and &

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: &&(logical)
and &(boolean logical) AND
 The basic difference between && and &
operators :
 && supports short-circuit evaluations (or partial
evaluations), while & doesn't.
 Given an expression:
exp1 && exp2
 && will evaluate the expression exp1, and
immediately return a false value is exp1 is false.
 If exp1 is false, the operator never evaluates exp2
because the result of the operator will be false
regardless of the value of exp2.
 In contrast, the & operator always evaluates
both exp1 and exp2 before returning an answer.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: &&(logical)
and &(boolean logical) AND

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: &&(logical)
and &(boolean logical) AND
 The output of the program is

 Note, that the j++ on the line containing


the && operator is not evaluated since the
first expression (i>10) is already equal to
false.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: || (logical) and
| (boolean logical) inclusive OR
 Here is the truth table for || and |,

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: || (logical) and
| (boolean logical) inclusive OR
 The basic difference between || and I operators :
 || supports short-circuit evaluations (or partial
evaluations), while | doesn't.
 Given an expression:
exp1 || exp2
 || will evaluate the expression exp1, and
immediately return a true value is exp1 is true
 If exp1 is true, the operator never evaluates exp2
because the result of the operator will be true
regardless of the value of exp2.
 In contrast, the | operator always evaluates both
exp1 and exp2 before returning an answer.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: || (logical) and |
(boolean logical) inclusive OR

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: || (logical) and
| (boolean logical) inclusive OR
 The output of the program is,

 Note, that the j++ on the line containing


the || operator is not evaluated since the
first expression (i<10) is already equal to
true.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: ^ (boolean
logical exclusive OR)
 Here is the truth table for ^,

 The result of an exclusive OR operation is TRUE,


if and only if one operand is true and the other is
false.
 Note that both operands must always be
evaluated in order to evaluate the result of an
exclusive OR.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: ^ (boolean
logical exclusive OR)

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: ^ (boolean
logical exclusive OR)
 The output of the program is

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: !
(logical NOT)
 The logical NOT takes in one argument,
wherein that argument can be an
expression, variable or constant.
 Here is the truth table for !,

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators: !
(logical NOT)

 The output of the program is

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators:
Conditional Operator (?:)
 The conditional operator ?:
 is a ternary operator.
 This means that it takes in three arguments that together
form a conditional expression.
 The structure of an expression using a conditional
operator is
exp1?exp2:exp3
 exp1 - is a boolean expression whose result must either be
true or false
 Result:
 If exp1 is true, exp2 is the value returned.
 If it is false, then exp3 is returned.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators:
Conditional Operator (?:)

 The output of this program will be

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Logical Operators:
Conditional Operator (?:)

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Operator Precedence

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Operator Precedence
 Given a compound expression,

6%2*5+4/2+88-10

we can re-write the expression and place


some parentheses based on operator
precedence,

((6%2)*5)+(4/2)+88-10

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Operator Precedence:
Best Practice
 To avoid confusion in evaluating
mathematical operations, keep your
expressions simple and use parentheses.

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Summary
 Java Comments (C++-Style Comments, C-
Style Comments, Special Javadoc
Comments)
 Java statements, blocks, identifiers,
keywords
 Java Literals (integer, floating point,
boolean, character, String)
 Primitive data types( boolean, char, byte,
short, int, long, float, double)
 Casting

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved
Summary
 Variables (declare, initialize, output)
 Scope of a variable
 System.out.println() vs. System.out.print()
 Reference Variables vs. Primitive
Variables
 Operators (Arithmetic operators,
Increment and Decrement operators,
Relational operators, Logical operators,
Conditional Operator (?:), Operator
Precedence)

Copyright 2008 Orange & Bronze Software Labs Ltd.Co. All Rights Reserved

You might also like