Being Java programmer.
Do I have to have JDK of the version whom I want to compile and run java program with ?
All things are lawful, but not all things are profitable.
yes I know that I need jdk to compile .java file so I can get .class file and JRE to run that .class file but I was asking about different JDK versions with new features as I mentioned above about default methods in interface since JDK 1.8 and later. I meant If I want to have practical experience of the changes took place in Java features, version wise then do I have to install JDK of all those versions? as StringBuilder was introduced in 1.5, correct me If I'm wrong, so to know that practically StringBuilder wasn't before 1.5 then do I need to install JDK 1.4 and set its path in eclipse mars so it will give compile time error? hope I'm clear now...If you want to compile a program, you need a JDK. To run a program after it's compiled you need a JRE
Being Java programmer.
I meant If I want to have practical experience of the changes took place in Java features, version wise then do I have to install JDK of all those versions?
All things are lawful, but not all things are profitable.
Being Java programmer.
Ganish Patil wrote:ohh ok, will download few versions just to check, anyway thank you once again for such quick reply
Tony Docherty wrote:
With javac you use the -target <release> switch to specify which version of Java you want to compile for.
Being Java programmer.
This is what I was looking for. Also how to compile a java program using JDK 1.4 and JDK 1.8 compiler through command prompt ( Not using any IDE).Tony Docherty wrote:
If you want to run code that is compiled for a specific version of Java you need to have a runtime for that version of Java or a later version. So you can compile for version 1.4 and run that code using a JRE version 1.4 or 1.5 or 1.6 or 1.7 or 1.8
Being Java programmer.
Being Java programmer.