Programming Language: Core Java
Programming Language: Core Java
Programming Language
The language which is used to write some instructions to get some work done by the System
is known as programming language.
A language which is easily understandable and executable by the machine is known as Low
level programming language.
Note:-A machine cannot directly understand the instructions written in high level programming
language, therefore these instructions needs to be compiled with the help of compiler before
executing .
Java
Java is a High Level Programming Language which is developed by James Gosling and his
team under sun microsystems. The first version of java was released on Jan 23,1996.
Features of Java
Simple
Secure
Robust
Multithreaded etc.
In java, the program written ( .java file) once compiled will not be converted to machine
understandable language. Instead it gets converted to an intermediate language called Byte Code.
This Byte code generated can be executed in any platform which is having JVM installed in it.
We cannot execute the bytecode in a system which is not having JVM installed in it. And there are
different versions of JVM available for different machines in the market. Therefore java is called
platform independent but JVM dependent language.
We can create the java source code with the help of editors.
Editor is a software which helps us to create files. Editor can be a plain editor(Eg:-Notepad, Editplus,
Notepad++ etc ) or advanced(Eg:-Eclipse, NetBeans , Atom etc).
We can compile the sourcecode (.java file) with the help of java compiler.
The compiler checks for the syntax and semantics, if everything is correct it generates the byte code.
Otherwise displays some error message.
This Byte code generated will be saved in a file called class file with .class extension.
The Byte code or .class file generated can be executed with the help of java command.
class ClassName
Example
class A
{
System.out.println(“Hello Shraddhaa!!!!”);
}
Step1:- As per the industry standards the name of the java file should be the same name which is
given to the class. And it must have .java extension.
Step2:- We can compile this .java file with the help of java compiler as follows
javac A.java
After the successful compilation the compiler generates .class file, which will have the same name
given to class.
A.class
java A
Note:- After successful execution we will get the output as shown bellow,
Hello Shraddhaa!!!!
Answer:-Yes, we can create and compile a class without main method. But it cannot be executed.