Chapt 4-5 notes

Chapt 4-5 notes - methods, encapsulation by using different...

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

View Full Document Right Arrow Icon
Order of statement execution is called the flow of control. Control flow “if” statement has the following syntax: if (Condition statement;) Condition evaluated – true – statement. (if false, it will skip the statement) <= means less than or equal to in java. Vice versa for greater than or equal to. Ex. if (sum>MAX) Delta = sum – MAX; System.out.println (“The sum is “ +sum) This will be false. Order of preceding. Mathematical operator Relational Operator (<>) Comparing is 2 equal signs, not 1. If (x == 5) INDENTATION WHEN USING IF ELSE STATEMENTS (FOR US, NOT FOR JAVA) if (sum>MAX) delta = sum – MAX; system.out.println(“The sum is “ + sum); if (choice >=1 && choice <=4) (Between 1 and 4) While loop, do loop, for loop. Add semi colon on do loops. == is only used when comparing integers and characters. Chapter 5 – Writing Classes class definitions, instance variables(date), methods, passing arguments to
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: methods, encapsulation by using different modifiers, constructor. A class is a blueprint of an object. Same as a blue print of a house. The object is the same as a real house. Access specifiers Private protect the variables from changing accidently. Cannot be called from outside the class blue print. Public The user can have access to it. EXAM CH 1-5 EMPHASIS 4 and 5. QUIZES ON BLACKBOARD MAKE NOTES PAGE STATIC METHODS Think of the member of the class versus member of the object. Static goes with the class. Variables can be static as well. EX. num of students. The user does not care how many students there are. Only the Administrators The ones who develop the class. Not every student is going to have a copy of numStudents. Therefore it is a static variable....
View Full Document

Page1 / 2

Chapt 4-5 notes - methods, encapsulation by using different...

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

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