Important Notes On JAVA
Important Notes On JAVA
Introduction to Java
Java is the object oriented programming language similar to C++ high level
programming language which was developed by Sun Microsystems in 1995. Java
was originally called OAK.
Object oriented means the capability to reuse the code.Secondly it is platform
independent because it is possible to develop a single application which can run on
multiple platforms like windows,UNIX systems.
The java compiler converts the source code of file extension .java to bytecode of
file extension .class and then java interpreter convert Bytecode to Machine code.
Features of java:
1. Compiled and Interpreter
2. Platform Independent
3. Object-oriented
4. Robust and Secure
5. Distributed
6. Simple, small and familiar
7. Multithreaded and Interactive
8. Dynamic and extensible code
9. Architectural Neutral
10. Portable
11. Interpreted
12. High performance
Application program requires a main function Applet does not require a main function for its
for its execution. execution.
Java application programs have the full access Applets don’t have local disk and network
to the local file system and network. access.
Applications can executes the programs from Applets cannot execute programs from the local
the local system. machine.
{
public static void main(String arg[])
{
Test t=new Test(2,3);// parametirzed constructor
t.display();
t.addition();
}
}
//Program to show Method overloading
public class MainOverload
{
public int sum(int x,int y)
{
return(x+y);
}
public double sum(double x,double y)
{
return(x+y);
}
}
}
//program to show the use of static keyword
class Counter
{
static int count=0;
Counter() //Default constructor
{
count++;
}
void Display()
{
System.out.println(count);
}