JAVA Notes
JAVA Notes
java.awt
java.io
java.net
java.sql
java.lang
java.util
Inheritance
Protected
Polymorphism
Platform Independence
Robust
Secure
Supports Multithreading
Dynamic
3) Type of inheritance
Character Streams − These handle data in 16 bit Unicode. Using these you can read and write text data
only.
Logical operators can be defined as a type of operators that help us to combine multiple conditional
statements. There are three types of logical operators in Java: AND, OR and NOT operators.
AND operator returns true when both conditions under evaluation are true, otherwise it returns false.
OR operator returns true if any one of the given conditions is true. OR operator returns false if and only
both conditions under evaluation are false.
NOT operator accepts a single value as an input and returns the inverse of the same. This is a unary
operator unlike the AND and OR operators.
Example-
class CommandLineExample
{
public static void main(String args[])
{
System.out.println("Your first argument is: "+args[0]);
}
}
Explain the concept of platform independence and portability with respect to Java language.
Java is a platform independent language. This is possible because when a java program is compiled, an
intermediate code called the byte code is obtained rather than the machine code. Byte code is a highly
optimized set of instructions designed to be executed by the JVM which is the interpreter for the byte
code. Byte code is not a machine specific code. Byte code is a universal code and can be moved
anywhere to any platform. Therefore java is portable, as it can be carried to any platform.
A constructor in Java is a special method that is used to initialize objects. The constructor is called when
an object of a class is created
Constructor with no arguments: Such constructors does not have any parameters. All the objects
created using this type of constructors has the same values for its datamembers.
Array Vector
Array is unsynchronized. Vector is synchronized.
Array is not a class. Array is a class.
An array is the static memory allocation. Vector is the dynamic memory allocation.
Wrapper classes are not use in array. Wrapper classes are used in array.
An array is a homogeneous. An array is a hetrogeneous.
Interface in Java
An interface in Java is a blueprint of a class. It has static constants and abstract methods.
start()-After init() method start() method is invoked. Executed when the browser is maximized
paint() - Paint method is used to display the content on the applet. We can create the objects or
components to the applet or we can directly write a message on the applet. It will take Graphics
class as a parameter.
stop() - stop() method is used to stop the applet. It is executed when the browser is minimized.
destroy() - destroy() method is used to completely close the applet. It is executed when the
applet is closed.
Runnable State - The runnable state means that the thread is ready for execution and is waiting for the
availability of the processor. In simple terms, the thread is ready but has not got the processor time.
Running State - When the thread starts executing, then the state is changed to a “running” state. The
scheduler selects one thread from the thread pool, and it starts executing in the application.
Blocked State - A thread is said to be blocked when it is prevented from entering into the runnable
state and subsequently the running state. This happens when the thread is suspended, sleeping, or
waiting in order to satisfy certain requirements.
Dead State - A thread is said to be in dead state when it has been killed by using kill() method or it has
successfully completed its execution.