Introduction

Java Programming

Java Programming Examples

What is JAVA?

Java is a high-level, third generation programming language, like C, C++, FORTRAN, Perl, and many others. Java use to write computer applications that play games, store data or do any of the thousands of other things computer software can do. Compared to other programming languages, Java is most similar to C. However although Java shares much of C's syntax, but it is not C. Knowing how to program in C or C++, will certainly help you to learn Java more quickly, but you don't need to know C or C++ to learn Java.

Java is a general-purpose, object-oriented programming language developed by Sun Microsystems of USA in 1991.Originally called Oak by James Gosling (one of the inventor of the language). Java was invented for the development of software for consumer electronic devices like TVs, tosters, etc. The main aim had to make java simple, portable and reliable.



How to Compile Java?

Use the following syntax to compile the program called helloworld.java in Terminal/Command Prompt

javac helloworld.java

The compiler has generated a bytecode file, helloworld.class at the same directory. Java class files are generated as per the classes name used in the source code.



How to run java class file?

Use the following syntax to run java class file called helloworld in Terminal/Command Prompt

java -cp . helloworld