Hello World
/ Noc_Luppus /
import java.uÂtil.Date;
public class Hello
{
public static void main(String[] args)
{
System.out.println("100 100 = 10,000 & 1000 100 = 100,000");
}
} // dont forget me
|
program development
program development = WHAT |
software design = HOW & create the pseudocode with classes and objects needed |
software implementation = requires the least amount of creativity |
goal of testing is to find logical and run-time errors |
class/method
public static void main(String[ ] args) |
A class constructor usually defines how an object is initialized |
A Java variable is the name of a data value stored in memory that can change its value but cannot change its type during the program's execution it all so can contain a value or a reference |
local variable's scope is restricted to the method where it was declared |
Abstract methods are used when defining abstract classes & Interfaces |
All classes in Java are directly or indirectly subclasses of the Object class |
Autoboxing is the automatic creation of a wrapper object from its corresponding primitive type, it also provides a static constant |
method overloading = having multiple class methods of the same name where each method has a different number of or type of parameters |
If two variables contain aliases of the same object thenthe object may be modified using either alias & the object will become an "orphan" if both variables are set to null |
Inheritance through an extended (derived) class supports code reuse |
Instance data for a Java class may be primitive types or objects |
Static methods cannot reference instance data |
The advantages of the DecimalFormat class compared with the NumberFormat class include precise control over the number of digits to be displayed |
The behavior of an object is defined by the object's methods |
The relationship between a class and an object is best described as a objects are instances of classes |
encapsulation, inheritance, polymorphism are the main programming mechanisms that constitute object-oriented programming |
all clases can have any number of children but only one parent |
compareTo is not a method of the Object class
|
|
JavaFX
A color image is broken down into individual pixels in RGB |
In a development environment that fully supports JavaFX, Since the launch method is called automatically, you do not need to write the main method, and the launch method is called automatically |
upper-left corner of a stage is (0,0) |
You should override the start method in a JavaFX Application |
Parent, Group, StackPane can be used as a root node in a JavaFX, ImageView cannot |
the javafx.scene.shape package includes classes that represent shapes in JavaFX |
windowsis not a kind of object that is used to create a graphical user interface in JavaFX |
array
in Java, arrays are objects |
int[ ] arr = new int[n]; arr.length = n Index = 0 - n-1 |
If a and b are both int arrays, then a = b; will create an alias |
an int array is passed as a parameter to a method you would say: (int[ ] a) |
if the statement arr[-1] = 0, it will thrown the ArrayIndexOutOfBoundsException Exceptions |
The "off-by-one" error associated with arrays arises because the first array index is 0 or the loop went to far |
str.charAt(2); could throw a StringIndexOutOfBoundsException becaus teh arry could be smaller than 3 |
Their lengths never change & The shortest string has zero length these are properties are true of String objects |
sorting algorithms
Neither method requires additional memory betwwen selection sort and insertion sort |
We compare sorting algorithms by examining the number of instructions executed by the sorting algorithm |
the efficiency of binary search is O(log2 n) |
enum Speed { FAST, MEDIUM, SLOW }; zero = FAST
exspetoins
A finally clause will execute in any circumstance |
An exception can produce a "call stack trace" which lists: the active methods in the opposite order that they were invoked |
NullPointerException and ArithmeticException are both derived from the RuntimeException class |
unchecked exception requires no throws clause |
checked exception requires a throws clause |
When a program terminates because a thrown exception is not handled, the program outputs a message indicating what and where the exception was thrown |
StringIndexOutOfBoundsException is for a string or arry trys to get a vule outside of the index of the object |
this is NOT a way: throw the exception to a pre-defined Exception class to be handled
|
|
UML
In a UML diagram for a class & there may be a section containing the attributes (data) of the class & there may be a section containing the name of the class & classes are represented as rectangles |
DEFF
instantiation |
creating a new object of the class |
Polymorphism |
is achieved by overriding |
flow of control |
The idea that program instructions execute in order (linearly) unless otherwise specified |
actual parameters |
The expressions that are passed to a method in an invocation |
exception propagation |
is The list of methods is known as the call stack and the method of searching them |
call stack |
0-9,$,-,a-Z |
allowed in an identifier |
(,{,[ --- (< does not) |
needs an associated "closing" character |
syntax |
gramer |
semantics |
comperhentoin |
base class is a parent class or super class |
child |
this |
An object that refers to part of itself within its own methods can use this reserved word |
super |
An object that access a parent class' constructor(s) , methods and instance data can use this reserved word |
new |
reserved words in Java is used to create an instance of a class |
LOOPS
The break statement transfers control out of the current control structure such as a switch statement |
the do loop will always execute the body of the loop at least once, thewhile dose not |
all three loop statements are functionally equivalent while loops and do loops are essentially the same; but while loops always execute at least once & if you know the number of times that a loop is to be performed, the best loop statement to use is a while loop & loops may be replaced by an appropriate combination of if-else and switch statements |
modifiers
public |
everyone can see |
private |
only child can inderectly interact |
protected |
only child can see |
static |
static means it belongs to the class not an instance |
abstract |
are used when defining: abstract classes, derived classes |
finsl |
cannot be changed |
|