First Program Discussing - Java Hello
o Class is a keyword which represent the class, we will learn about class later.
o Public static void main (String arg[]){
}
o This is pre define main method. Whenever you compile the java Program the Java Virtual Machine first check the main method, if no main method will found, then it will generate the error. So, main method is a necessary method, every program of java will start processing from main method.
o Java is case sensitive
o Java class name first letter is always Capital I.e. Demo
o Access modifier: default, public, protected, private
o Non-access modifier: final, abstract, strictfp.
Hello with Eclipse IDE Java First Program
o First download the eclipse from Eclipse official website
o After download Extract the ZIP folder, then double click on eclipse Setup
o Then its ask for Workspace (workspace is a place where your all project will be saved permanently) so choose the path as you want or leave it as default path.
o After eclipse load it show you following output
file menu Java Hello
o Close the welcome page go to file menu click on New > Java Project see image below
o Then a new window open write project name and fit finish button
o As I give project name “Demo”, now in eclipse your new created project will be shown under Package Explorer tab, expand the demo > right click on src> click on classsee image below
A new window will be opened then write package name (optional) >Class name> fit the Finish button
Hello java output
o Now output looks like this
o
Now to run this program right click on Hello.java> click on Run> click on Java Application
o Output will be display on Console Tab see image below:
o Now hope it’s clear to you about eclipse environment. Same thing you can do with NetBeans IDE; I’m not going to create example with NetBeans IDE; As if you want to work with Integrated Development Environment (IDE) then I’m suggesting you to use Eclipse rather than NetBeans because Eclipse is more light weight then NetBeans and its performance is more accurate.
No comments:
Post a Comment