The one thing I learned before entering into the world of JAVA is once you learn the basics it's as simple as any other language you'll learn, everything depends on how you prefer to use it. All you need is constant practice and a playful attitude, and make as much mistakes as you can, only then can you learn to use it well.
First step:
Download JDK 1.8 which is easily available in the internet. Then download the right package for your platform. Windows and Solaris users should visit Oracle's Java SE page to download a package, Macintosh users will find they have the Java SE installed. Similarly there are different JVM for 32-bit and 64-bit machine.
Download JDK 1.8 which is easily available in the internet. Then download the right package for your platform. Windows and Solaris users should visit Oracle's Java SE page to download a package, Macintosh users will find they have the Java SE installed. Similarly there are different JVM for 32-bit and 64-bit machine.
One specialty about Java is that it is platform independent, meaning the code remains same in any platform/ operating system you use whether it's Windows, Linux or Solaris.
How is this? Since any high-level language has to be translated into machine language to run it on computer,your source code is converted into byte code by Java compiler (which is done by eclipse).When you compile a Java program it creates .classfiles, which is a collection of byte codes.
Now byte codes here are not machine instructions but the instructions which Java Virtual Machine (JVM) can understand. So, again we need another software called JVM to convert bytecode into machine language and execute the instructions. Here, bytecode is platform independent not JVM.
To, make it clearer, when you download Java software what you get is JRE(Java Runtime Environment) which consists of Java Virtual Machine (JVM) in it. Now the role here of JVM is to convert the bytecode into machine language which is platform specific therefore you get different version of JDK(Java development kit) and JRE(Java Runtime Environment) for different operating systems making JVM platform dependent.
Now byte codes here are not machine instructions but the instructions which Java Virtual Machine (JVM) can understand. So, again we need another software called JVM to convert bytecode into machine language and execute the instructions. Here, bytecode is platform independent not JVM.
To, make it clearer, when you download Java software what you get is JRE(Java Runtime Environment) which consists of Java Virtual Machine (JVM) in it. Now the role here of JVM is to convert the bytecode into machine language which is platform specific therefore you get different version of JDK(Java development kit) and JRE(Java Runtime Environment) for different operating systems making JVM platform dependent.
Second step:
Now download Eclipse that helps us writing the code 8000 times easier, it reports any error you code, helps your with methods, imports and many more.
Now download Eclipse that helps us writing the code 8000 times easier, it reports any error you code, helps your with methods, imports and many more.
Third step:
Then you should start with a simple hello world program.
Then you should start with a simple hello world program.
Public class Hello{
public static void main(String {} args){
system.out.println("Hello world");
}
}
Fourth step:
Then all that is remaining is for you to run your first program. Right click and there is the option called -Run As--> 1 Java Application and waala! the "Hello world" is printed in console.
Then all that is remaining is for you to run your first program. Right click and there is the option called -Run As--> 1 Java Application and waala! the "Hello world" is printed in console.
Found it easy? We use the same above basics further in Java programming. First is the class in line 1: Hello is our class name. Second is the main method in line 2: that helps to execute our codes. And third is system.out.println- that helps to print in console the item within the brackets.