- Works in offline mode
- Provides Random Working Proxy and Untested Anonymous Proxies
- Now with GLITCH Patching System
- Faster and Easier ProXPN.ovpn Proxy Configuration
Research 10 Java Exceptions.
1. ArrayIndexOutOfBoundsException
2. ArrayListException
3. NumberFormatException
4. IOException
5. FileNotFoundException
6. ArrayOutOfBoundsException
7. FontFormatException
8. TooManyListenersException
9. NegativeArraySizeException
10. InstantiationException
· OBJECT-ORIENTED PROGRAMMING
- is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships.
OOP (Object-oriented programming) = encapsulated state + inheritance
Object-Oriented Design
– Focuses on object and classes based on real world scenarios
– Emphasizes state, behavior and interaction of objects
– Advantages:
·Faster development
·Increased quality
·Easier maintenance
·Enhanced modifiability
·Increase software reuse
· ENCAPSULATION
- Combine the data and the operations
- Enclosing of both variables and functions
- Keep details of the data and operations from the users of the ADT
- Once you have created an ADT for complex numbers, say Complex, you can use it in the same way like well-known data types such as integers.
– Principle of hiding design or implementation information not relevant
to the current object
· OBJECT
- An entity with unique identity that encapsulate state
- state can be accessed in a controlled way from outside
- The access is provided by means of methods (procedures that can directly access the internal state)
· CLASS
- A specification of objects in an incremental way
- By inheriting from other classes
- And specifying how its objects (instances) differ from the objects of the inherited classes
·CLASS VARIABLE
– Behave like a global variable
– Can be accessed by all instances of the class
·CLASS INSTANTIATION
The process of creating objects from a class is called instantiation. So an object is always an instance of a class which represents the blueprint.
The object is constructed using the class and must be created before being used in a program.
Objects are manipulated through object references (also called reference values or simply references)
Creating objects in Java usually follow these steps:
1- Declaration of a reference variable of the appropriate class which will store a reference to the object.
For example:
//declaring my car
Car myCar;
// declaring my father's car
Car myFatherCar ;
Or combined if they belong to the same appropriate class, separated by a comma:
//declaring my car and my father's car
Car myCar, myFatherCar ;
2- Creating an object
This involves using the new operator and calling a constructor to create an instance of the class.
The new operator returns a reference to a new instance of the Car class.
The reference can be assigned to a reference variable of the appropriate class, here: myCar and myFatherCar.
// instantiating myCar from the class Car,
//having the String "black" as parameter value.
myCar = new Car("black");
// instantiating myFatherCar from the class Car
//having the String "blue" as parameter value.
myFatherCar = new Car("blue");
Each object has a unique identity and has its own copy of the fields declared in the class.
The purpose of calling the constructor on the right side of the new operator is to initialize the newly created object.
The declaration and initialization can be combined:
// declaring and instantiating myCar from the class Car,
//having the String "black" as parameter value.
Car myCar = new Car("black");
// declaring and instantiating myFatherCar from the class Car
//having the String "blue" as parameter value.
Car myFatherCar = new Car("blue");
·METHOD
– Describes the behavior of an object
– Also called a function or a procedure
– Student registration system example
· METHOD DECLARATION
To declare methods we write,
}
– where,
●
●
●
●
· STATIC METHOD
public class StudentRecord {
private static int studentCount;
public static int getStudentCount(){
return studentCount;
}
}
– where,
· public- means that the method can be called from objects outside the class
· static-means that the method is static and should be called by typing,
[ClassName].[methodName]. For example, in this case, we call the method
StudentRecord.getStudentCount()
· int- is the return type of the method. This means that the method should return a
value of type int
· getStudentCount- the name of the method
· ()- this means that our method does not have any parameters
· PARAMETER PASSING
- Pass by Value refers to passing a constant or a variable
holding a primitive data type to a method, and
- Pass by Reference refers to passing an object
variable to a method. In both cases a copy of the variable is passed to the method.
A. PRIMITIVE DATA TYPES
- Integral Data Types (byte, short, int long)
- Floating Point (float, double)
- Characters (char, string)
- Boolean (true, false)
B. VARIABLES
A variable is an item of data used to store state of objects.
1. Declaring and Initializing Variables
To declare a variable is as follows,
2. Outputting Variable Data
In order to output the value of a certain variable, we can use the following commands,
System.out.println()
System.out.print()
C. OPERATORS
1 Arithmetic operators
+, *, /, %, -
2 Increment and Decrement operators
++, --
3 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.
>, >=, <, <=, ==, != 4 Logical operators
Logical operators have one or two boolean operands that yield a boolean result. There
are six logical operators: && (logical AND), & (boolean logical AND), (logical OR),
(boolean logical inclusive OR), ^ (boolean logical exclusive OR), and ! (logical NOT).
D. GETTING INPUT FROM THE KEYBOARD
1. Using buffered reader
·Add this at the top of your code:
import java.io.*;
·Add this statement:
BufferedReader dataIn = new BufferedReader(
new InputStreamReader( System.in) );
· Declare a temporary String variable to get the input, and invoke the readLine()
method to get input from the keyboard. You have to type it inside a try-catch block.
try{
String temp = dataIn.readLine();
}
catch( IOException e ){
System.out.println(“Error in getting input”);
}
2. Using JOptionPane
import javax.swing.JOptionPane;
indicates that we want to import the class JOptionPane from the javax.swing package.
We can also write this as,
import javax.swing.*;
The statement,
name = JOptionPane.showInputDialog("Please enter your name");
creates a JOptionPane input dialog, which will display a dialog with a message, a
textfield and an OK button as shown in the figure. This returns a String which we will
save in the name variable.
E. CONTROL STRUCTURES
1. Decision Control Structures
Decision control structures are Java statements that allows us to select and execute
specific blocks of code while skipping other sections.
· if statement
if( boolean_expression )
statement;
· if-else statement
if( boolean_expression )
statement;
else
statement;
· if-else-if statement
if( boolean_expression1 )
statement1;
else if( boolean_expression2 )
statement2;
else
statement3;
· switch statement
switch( switch_expression ){
case case_selector1:
statement1; //
statement2; //block 1
. . .
//
break;
case case_selector2:
statement1; //
statement2; //block 2
. . .
//
break;
. . .
default:
statement1; //
statement2; //block n
. . .
//
break;
}
2. Repetition Control Structures
Repetition control structures are Java statements that allows us to execute specific
blocks of code a number of times. There are three types of repetition control structures,
the while, do-while and for loops.
·while loop
The while statement has the form,
while( boolean_expression ){
statement1;
statement2;
. . .
}
· do-while loop
The do-while statement has the form,
do{
statement1;
statement2;
. . .
}while( boolean_expression );
· for loop
The for loop has the form,
for (InitializationExpression; LoopCondition; StepExpression){
statement1;
statement2;
. . .
}
F. Java Arrays
1. Declaring Arrays
Arrays must be declared like all variables. When declaring an array, you list the data
type, followed by a set of square brackets[], followed by the identifier name. For
example,
int []ages;
or you can place the brackets after the identifier. For example,
int ages[];
After declaring, we must create the array and specify its length with a constructor
statement. This process in Java is called instantiation (the Java word for creates). In
order to instantiate an object, we need to use a constructor for this. We will cover more
about instantiating objects and constructors later. Take note, that the size of an array
cannot be changed once you've initialized it. For example,
//declaration
int ages[];
//instantiate object
ages = new int[100];
or, can also be written as,
//declare and instantiate
object
int ages[] = new
int[100];
2. Accessing an array element
To access an array element, or a part of the array, you use a number called an index or
a subscript.
3. Array length
In order to get the number of elements in an array, you can use the length field of an
array. The length field of an array returns the size of the array. It can be used by writing,
arrayName.length
4. Multidimensional Arrays
Multidimensional arrays are implemented as arrays of arrays. Multidimensional arrays
are declared by appending the appropriate number of bracket pairs after the array name.
G. JAVA APPLETS
· Life cycle of an applet
-init()
-start()
-stop()
-destroy()
· drawing strings
drawString();
· drawing ovals
drawOval();
· drawing polygons
drawPolygon();
· drawing rectangles
drawRect();
· drawing lines
drawLine();
· changing font color, size, type, and styles
I. FILE HANDLING
· Reading inputs from a text file
· Writing outputs in a text file
Copyright 2009 - The Great Symbian
Blogspot Theme designed by: Ray Creations, Ray Hosting.