Breaking News
You are here: Home / Notes / SEM-4 / JAVA / Java Development Kit and Its Uses

Java Development Kit and Its Uses

Java Development Kit and Its Uses

java development kit

java development kit

 

The Java Development Kit (JDK) is a Sun Microsystems product aimed at Java developers.

  1. JDK comes with a collection of tools that are used for developing and running Java program.
  2. It is a bundle of software that you can use to develop Java based applications.
  3. Java Development Kit is needed for developing java applications.
  4. JDK include below :
    • Java: Java interpreter, which runs applications by reading and interpreting bytecode files.
    • Javac: The java Compiler, which translates sourcecode to bytecode files that the interpreter can understand.
    • Appletviewer:  it enables us to run java applets without actually using a java compatible browser.
    • Javadoc:  It creates HTML format documentation from java source code files.
    • Jdb: Java debugger, which helps us to find errors.

 

Java Virtual Machine (JVM):

 

It is an abstract computer or virtual computer which runs the compiled Java programs. It provides abstraction between compiled java programs and the hardware and operating system.

 

A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer’s processor (or “hardware platform”) so that it can perform a Java program’s instructions. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the platform.

 

The Java Virtual Machine is responsible for interpreting Java bytecode, and translating this into actions or operating system calls. For example, a request to establish a socket connection to a remote machine will involve an operating system call. Different operating systems handle sockets in different ways – but the programmer doesn’t need to worry about such details.  It is the responsibility of the JVM to handle these translations, so that the operating system and CPU architecture on which Java software is running is completely irrelevant to the developer.

 

Java Compiler:

To commence with Java programming, we must know the significance of Java Compiler. When we write any program in a text editor like Notepad, we use Java compiler to compile it. A Java Compiler javac is a computer program or set of programs which translates java source code into java byte code. The output from a Java compiler comes in the form of Java class files (with .class extension). Java source code contained in files end with the .java extension. The file name must be the same as the class name, as classname.java. When the javac compiles the source file defined in a .java files, it generates bytecode for the java source file and saves in a class file with a .class extension.

java program execution process

Java Interpreter:

          An interpreter is a computer program that makes a real cpu, such as an Intel Pentium, simulate the idealised Java CPU. An interpreter does not convert the JVM byte codes to machine code. It runs the JVM byte codes directly, using a program to simulate, in every detail, exactly what an idealised Java CPU would do. There are cpus that can run JVM byte codes directly as their native machine code. When you use these, that is not called interpreting. It is only called interpreting when you use a program to make one computer pretend to be another.


Java Debugger:

          Java debugger helps in finding and the fixing of bugs in Java language programs. The Java debugger is denoted as jdb. It works like a command-line debugger for Java classes.

Sun’s Java Development Kit (JDK) includes a debugger called JDB (Java Debugger), a command-line application under which you can execute the programs you need to inspect. With JDB, you can inspect variables while a program is running, set breakpoints to halt the execution of a program at a certain point, and execute code line by line. You can see just how the contents of variables change after each statement of program code, and you can precisely trace the execution of a program even as it branches to other functions or iterates through loops. JDB is also useful to debug Graphical as well as Applet program.

 

Program Features:

  1. Java is case sensitive language.
  2. All statements must be end with the semicolon.
  3. Java is a built upon C and C++. It derives its syntax from C and the object oriented features are influenced by C++.

 

General Program Structure:

Document Section

Package Statement

Import Statement

Interface Statement

Class Definitions

Main method class

{

          Public static void main(String args[])

}

 

Document Section

Document Section comprise a set of comment lines giving the name of the program, the author and other details, which the programmer would like to refer at a later stage.

 

Package Statement

  • The first statement allowed in Java is a package statement. Package statement declares a package name and informs the compiler that the classes defined here belongs to this package.
  • Syntax : package <name>
  • The package statement is optional, That is, our classes should not have to be part of a package.

 

Import Statement

  • This is similar to #include syntax in C
  • Syntax : import packagename.classname;
  • Ex. Import student.test;
  • This statement instruct the interpreter to load the test class contained in the package student.

 

Interface Statement

  • An interface is like class but includes a group of method declaration.
  • This is also an optional section and is used only when we wish to implement the multiple inheritance features in the program.

 

Class Definitions

  • A Java program may contain multiple class definitions.
  • Classes are primary and essential elements of Java program.

 

Main method class

  • Since every java stand alone program requires a main method as its starting point, this class is an essential part of Java program, All Java applications begin execution by calling main().
  • A Simple java program may contain only this part.

 

The public keyword is an access specifier, which allows the programmer to control the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared. In this main() must be declared as a public, since it must be called by code outside of its class when the program is started.

 

The keyword static allows main to be called without having to instantiate a particular instance of a class. This is necessary since main() is called by the java interpreter before any objects are made.

 

The keyword void simply tells the compiler that the main() does not return a value.

 

String args[] declares a parameter named args, which is an array of instances of the class String. In this case, args receives any command –line arguments present when the program is executed. If there are no parameters required for a given method, you still need to include the empty parentheses.

 

System is a predefined class that provides access to the system, and out is the output stream that is connected to the console.

 

Output is actually accomplished by the built-in println() method, pritntln() method displays the String which is passes to it.

Simple Java Program:

public class HelloWorld 
{
     //method main(): ALWAYS the APPLICATION entry point
    public static void main (String[] args) {
	System.out.println ("Hello World !");
    }
}

For compiling this program
	javac HelloWorld.java
For running this program
	java HelloWorld

Download Paper Solutions from Below Link

About admin

Scroll To Top