3:50 pm - Monday February 19, 1923

Getting started with java

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

Getting started with java

Java is an open source software anyone can Download  the software from oracle link http://www.oracle.com/technetwork/java/javase/downloads/index.html  and install it.

 

l  Java is case sensitive

whitespace doesn’t matter for compilation

 

Setting class path to java

  1. Open cmd from run

 

 

Now type set path=”location of ur java bin folder”

 

 

To check whether the path has been set properly type javac and press enter

 

 

 

 

Developing your first java program

 

Open an editor like notepad, wordpad, notepad++.. etc, and start typing or paste the code given below

 


//simple program to display welcome in java

class Sample

{

public static void main(String arg[])

{

System.out.println(“welcome”);

}

}

Save your java code as Sample.java

 

Compiling your java code:

                Javac Sample.java

Javac is a command used to compile your java code

 

Executing your java program

Java Sample.java

Java is an interpreter used to execute your class file

 

Naming Standards:

 

Keywords

Keywords should be in small letter

Ex:

public , static, int, float etc..

 

Class name, interface name

First letter should be caps and first letter in a  2nd word also be in caps

This type of naming convention is known as Pascal naming convention.

Ex:


class CandidTraining{

}

<strong> 

Methods and variable

Starts with a small letter and first letter in a 2nd word should be caps

The other convention, the camel naming convention, capitalize the initial of each word, except the first word

Ex:

void setData()

Constants:

Should be in CAPS

Ex:


public static final int MIN=10;

Types of errors:

  1. Syntax Errors

Detected by the compiler

  1. Runtime Errors

Causes the program to abort

  1. Logic Errors

Produces incorrect result

 

 BACK

Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply