Introduction::
Java is a programming language that was developed by the sun microsystems in 1991.Its original name was Oak and later on was renamed to JAVA. It is the programming language having much of the syntax same as c and c++. Now before starting with the tutorial you must have java virtual machine which compiles source code into byte code.As byte code is platform independent this code can be run on various platforms i.e code compiled on windows can be run on linux platform.This makes Java highly portable language Now to install jvm(java virtual machine)you have to install jdk on your O.S.You can download this at www.java.sun.com/downloads.
Another important thing that is needed is an editor in which you write a code.Nowadays different editors and IDE's are available.Some of them are editplus,Jcreator,netbeans,eclipse etc.But you can also write code in notepad and save the file with ".java" extension.
Considering you know some amount of coding let start with our first example.
public class mainclass
{
public static void main(String args[])
{
System.out.println("HELLO Reader!!");
}
}
now following are the steps to compile if your path is set in command prompt then javac mainclass.java
--the above code wont show any errors java mainclass
Output of above program would be HELLO Reader!!
Now the file name should be the same as class name.
Following are some of the utilities of jdk as well as their description(short)
Tool                                                                                         Function
javac                                                                       The Java compiler. Converts Java source code into bytecodes.
java                                                                   The Java interpreter. Executes Java application bytecodes directly from class files. appletviewer                                                        A Java interpreter that executes Java applet classes hosted by HTML files.
javadoc                                                            Creates HTML documentation based on Java source code and the comments it contains. rmic                                                                   Creates class files that support Remote Method Invocation (RMI).
rmiregistry                                                            Registry used to gain access to RMI objects on a specific machine.
rmid                                                                 Activation system daemon for RMI object registration and activation.
native2ascii                                                    Special program used to convert between standard Latin-1 Unicode characters and                                                                                   other international encoding schemes.
jar                                                                       Java Archive (JAR) file generator. JAR files allow multiple Java classes and resources                                                                              to be distributed in one compressed file.
keytool                                                                    Used for security key generation and management. jarsigner Implements digital                                                                                      signing of JAR and class files. Allows applets to be certified by trusted authorities.
policytool                                                          Allows user-installation-level security policy configuration.
Done with this then data types that are used in c and c++ all are present in java except that of pointers and structures Here boolean datatype is also there string is an inbuilt data type.some other additions are date and calendar.
Again operators which we use in c and c++ are same here.
Control statement and looping statement are same as that of c and c++ with an addition of foreach loop foreach loop
(general form)code is as below
for(type itr-var : iterableObj) statement-block
public class MainClass
{
public static void main(String args[])
{
int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
for(int x : nums)
{
System.out.print(x + " "); x = x * 10;
}
System.out.println();
for(int x : nums)
System.out.print(x + " ");
System.out.println();
}
}
here its an read only loop....which will print 1-10 2 times here is another example
import java.util.ArrayList;
public class MainClass
{
public static void main(String args[])
{ ArrayList list = new ArrayList();
list.add(10.14); list.add(20.22);
list.add(30.78); list.add(40.46);
double sum = 0.0;
for(double itr : list)
sum = sum + itr;
System.out.println(sum);
}
}
output of above code will be 101.6
let us end 1st part of tutorial.
I will be back with more examples and concept in next

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

Which banking interface is the best and easiest to use?

Which banking interface (among the ones listed below) do you like and consider it to be the best and easiest to use?
No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 5 answer(s).
/polls/miscellaneous/6542-which-banking-interface-is-the-best-and-easiest-to-use.json?task=poll.vote
6542
rmXMlNhHM4uoDaL6
radio
[{"id":"22726","title":"ICICI","votes":"13","type":"x","order":"1","pct":22.81,"resources":[]},{"id":"22727","title":"Punjab National Bank","votes":"6","type":"x","order":"2","pct":10.53,"resources":[]},{"id":"22728","title":"SBI","votes":"18","type":"x","order":"3","pct":31.58,"resources":[]},{"id":"22729","title":"Axis Bank","votes":"7","type":"x","order":"4","pct":12.28,"resources":[]},{"id":"22730","title":"HDFC ","votes":"13","type":"x","order":"5","pct":22.81,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
Why to choose Java? In the computer market, being able to use Java is a crucial knowledge. Java is a development terminology used to build compelling
DATABASE CONNECTIVITY This articles explains the need of database connectivity, the way it is achieved through Java using the JDBC(java database connectivity)
  Write your first simple java program.   First of all we need is a placewhere we can write your Java code. All Java programs are written using
Array of objects in Java Arrays are defined as block of continous memory locations which are arranged in one after another. Elements of the Array can
Synchronized block is alternative mechanism for "synchronized" methods.If we inherihate the non synchronized blocks either from base class or interface