what is java

What is Java Programming language?

Posted on

Java

Java is a programming language base on object-oriented programming language can run on all platforms. In 1995, Sun Microsystems developed  java from OAK programming language. Java SE and JVM can install all platforms and JVM know bytecode. If all students start to learn java language, to learn OOP concept and your machine installed Java SE latest version. Java is open source libraries.

What is java syntex?

All codes store in .java extension. public is default keywords for main class and class name is same source filename. example, if class name is HelloWorld, source file name is HelloWorld.java. Default function or method always need main method – public static void main(String[] args). Following example code:

public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello World!”); // Prints the string to the console.
}
}

When you save all code in HelloWorld.java. Using command line, path is java se directory and go to bin directory. Doing compile code is “javac HelloWorld.java”. It generate bytecode file extension is .class. And Run command is “java HelloWorld”. In command line, You see Hello World!.

 

Keywords

public keyword use in method or class that can be called from code in other classes and may be used by classes outside the class hierarchy. private use in a method that can only be accessed in the same class and protected is in class that allows code from the same package to access.

static keyword in front of a method that cannot access any class members that are not also static.

void keyword in front of a method that does not return any value to the caller.

public static void main(String... args) must use in project main class.

 

Libraries

Java SE includes base in libraries. There are core libraries, integration libraries, user interface libraries and etc.. The Core libraries is the standard libraries that developed to support application development in Java. The integration libraries which allow the application writer to communicate with external systems. The user interface libraries which allow GUI components and events of via.

Core libraries are include all java class path that is example java.io.*. java is main library of import of main class. These are utilities, networking, generics, concurrency, security, xml, sitemap, collection and functional and etc..,

Integration libraries includes database connectivity, naming directory, remote function, and management between applications or platforms.

User interface libraries include heavyweight, lightweight, audio and javafx (all platforms).

Conclusion of libraries, javadoc is a documentation of java language. These include detail of library and how to use with examples. Some people know javadoc but not all.

Example of command line arguments :

class Hello
{
public static void main(String[] args)
{
// check if length of args array is
// greater than 0
if (args.length > 0)
{
System.out.println(“The command line”+
” arguments are:”);

// iterating the args array and printing
// the command line arguments
for (String val:args)
System.out.println(val);
}
else
System.out.println(“No command line “+
“arguments found.”);
}
}

 

enjoy! to start java

Leave a Reply

Your email address will not be published. Required fields are marked *