Login or Register

  Welcome: Guest


Home >> Article >> Programming >> Java >> Post New Article Bookmark and Share

Starting Java Programming

December 26, 2012  by: Joseph  Points: 12   Category: Java  Earning $0.50   Views: 624

Java is computer language. It help the user to develop softwares,programs and even games also. It is easy to study this computer language. Sometimes you may see certain title says java games, java apps when you try to download mobile apps from mobile store. That means this app is made with java language. This article is about how to write and run a java program.

         

Introduction



In my previous article i wrote about how to write and run a C++ program http://www.exposeknowledge.com/kb/9418-basic-c-program.aspx . This is about Java program.

Java is a computer language. It is a member of family C language. This computer language has many advantages you can develop softwares,programs and even games also. This language not much difficult to study. When we compare Java with C++, java requireds only few steps to create program than C++. First of all starting Java basics with a small program.

Starting Java Programming



//welcome to java
import java.io.*;
class c1 {
public static void main(String args[]){
system.out.printIn(" Welcome to Java program");
}
}



This is a small java program which tell the computer to show the message- 'Welcome to Java'. When you compile this program it will show the message.Follow is an example of a program written in notepad


Step1:

//welcome to java
- This is a comment line which used to explain the statement of the program. The comment line do not have much importance but it is used to help the user to remember the function of different lines. The function of comment line is same as in C++. You can write comment line in any where in a program. To use comment line you have to put // and write the message. It is not an important code in a program. If you want only use.

Step2:

import java.io.*;
- Like C language java also have header files. This header file is used for the input, output operation. It is an important part of a java program because without input-output operation it is impossible to run a program. So it is needed. It is a preprocessor.

Step3:

public class c1
- Every java program is stated as a class. Class means a group object having similar properties or characteristics. Eg: if fruit is a class apple,orange,mango etc are the object. It is also an important part of a program. C1 means the name of the program.{ this bracket indicates that the function of the program is going to start.

Step5:

public static void main (String args[]){
- This line is an important part of a java program. Actually our program is to show a message. A message is represented as string. To write a message we use this line but according to the program function this line may vary. Eg: for graphics the main line is like this "public void paint(Graphics g). Here the { bracket represent the main function of the program is going to start.

Step6:

System.out.printIn("Welcome to Java program");
- This is line say the computer to display the message 'Welcome to Java program'. Here system.out.printIn means that to perform the function as an output. So the user can see the result.
And last the 2 } brackets represent the end of the functions which we started by opening brackets.

All the steps are over now lets we can check how to run this program. First of all you need a jdk software which help in running java program. If you don't have download it from here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html
And MS Dos software if you don't have you can download it from here:
http://www.brothersoft.com/ms-dos-226177.html .Below is an example of a compiled java program to show a message


Step1:

Open your Notepad and write the java code.

Step2:

Save it as like name.java and include it in your jdk/bin.

Step3:

Open your MS Dos directory and write there 'javac name.java'

In a few minute the compile will start if there is any error then it would be displayed. This only a small program try to learn more about java program and try to develop programs and softwares . All the best




Comment(s)

No response found. Be the first to respond to this post

Post Comment

Please Log In  to post comment

Related Resources



Usage of Java Programming and Concepts
Describes the salient features of Java and explains about the usage of java.

Use of switch in java programming
Switch is a conditional statement which used to pick a statement if the condition and expression are equal. This article explains about the use and functioning switch along with example.

About Java
Java is a purpose object oriented programming language

Enterprise Java Beans : An Overview
This article contains basic information about Enterprise Java Beans (EJBs)Technology .

Application Deployment Tool in java
Java Based Tools for testing and deployment tool

Latest Resources From The Same Category



Use of switch in java programming
Switch is a conditional statement which used to pick a statement if the condition and expression are equal. This article explains about the use and functioning switch along with example.

Addition of 2 numbers in java program
For starting with Java we need to know 2 things first is how to print a message and how to accept 2 numbers & print there sum. This article is about how to create a program which accept 2 numbers and print there sum.

Starting Java Programming
Java is computer language. It help the user to develop softwares,programs and even games also. It is easy to study this computer language. Sometimes you may see certain title says java games, java apps when you try to download mobile apps from mobile store. That means this app is made with java language. This article is about how to write and run a java program.

Usage of Java Programming and Concepts
Describes the salient features of Java and explains about the usage of java.

Threads in Java
Here is the most commonly used concept i.e. threads in Java.

 

Top Performers     Top Contributors     Share and Earn     Terms of Service    Privacy Policy     Contact Us