Our social:

Tuesday, August 16, 2016

Getting started with Java – How Can Your first Java program-Best Education Service

[Tutorial 1] : Getting started with Java – Your first Java Program.

Hey  , Are you waiting for a perfect guide to Get started with Java ? Have you been up and down to seek  a website that enables you to Learn Java easily ? Have you failed in getting the  perfect online tutor for you ?
Well , You are at the right place. Bookmark Us and never run out of quality Java Tutorialsthat will be an important part in your Java Learning process.
In this java tutorial, we will teach you how to get started with Java and how to create a simple program with Java.

What is java?

Java is a very strong high-level programming language for beginners as well as professionals. We can create a large number of programs varying from small programs to print your name to various large games. All can be done using Java.
Java.com says –
Java is a programming language and computing platform first released by Sun Microsystems in 1995. There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game consoles to scientific supercomputers, cell phones to the Internet, Java is everywhere!

Why do you need Java ? 

This is probably the first question in your mind. Why do you need Java ? What is the use of Java ?
Well , Java has a wide variety of uses in the digital world. As claimed by Sun Microsystems Java is used in trillions of devices including “TV Set-up boxes , Refrigerators and all other electronic devices that you can think of 😀 Apart from the electronic devices  , Java also has a wide variety of uses in the field of computers as it is used in making a wide variety of programs including some really big games. Java is also an operating system for mobile devices and can be used to make mobile applications also.

Your first java program

It is said that practical brings you far more knowledge than theories. So as of now , we will skip more definations and explanations and we will proceed directly to the pragramming part and learn how to make a simple Java program. More explanations and definations about Java will be shared later in other tutorials.
In order to  get started with Java, we will first create a simple java program instead of getting into more details and explanations.
NOTE – This is the program to print the following text
Hello !! My name is Pranshu KharkwalI am learning java.
 public class mydetails 

                public static void main()
                                System.out.println(“Hello !! My name is Pranshu Kharkwal”);                                 System.out.println(“I am learning java”);                   }  
 This is how it looks when you type it as the source code :-
programs in java

Confused ?

Dont Miss – Operators in Java – Their Use and Syntax

Let me explain the meaning and the working of each and every line.
  • FIRST LINE  ( public class mydetails )  – In the first line of the program , we define a class. Class is like an identity to the program. The are further more uses of Class which you can find here. You can give any suitable name to your class. To give name to class , type :
    “public class”  followed by the name you want to give. Example :-
    public class  learning_java
The class is to give identity to the program and it must be included in every program.
  • SECOND LINE ( { )– In the second line, there are the opening braces of class. This is just to mark the starting of the program and the starting of the class. Nothing more about it but keep in mind that it must be there in each and every program.
  • THIRD LINE ( public static void main() ) – In the third line, we are defining the method. Same exact keywords as above must be typed in the program. The is more flexibility in defining the method but for the time being, we are not introducing it as it may confuse you. So, keep in mind that this is important to type those exact word “public static void main()” and the ” main() ” are extremely important.
public static void main()
  • FOURTH LINE ( { ) – The fourth line has the opening braces of the method. Functions in the same way as the opening braces of class i.e. to mark the beginning of main.
Now we enter into the mainstream of the program
  • FIFTH LINE (     System.out.println(“My name is Pranshu Kharkwal “);    )- The words “System.out.println” are the words defined by Java that are used to print anything we desire. You need to put simple brackets just after “ System.out.println ”and then put “” between the brackets. Whatever you type in between “ System.out.printin(“”);  ”  is printed by the Java compiler.
System.out.println(“My name is Pranshu Kharkwal”);
IMPORTANT NOTE – Don’t forget to put a semicolon just after the closing bracket.
  • SIXTH LINE (     System.out.println(” I am learning Java “);    )- The words “System.out.println” are the words defined by Java that are used to print anything we desire. You need to put simple brackets just after “ System.out.println ” and then put “” between the brackets. Whatever you type in between “ System.out.printin(“”);  ”  is printed by the Java compiler.
  • SEVENTH LINE (  } )– These are the closing braces of main which indicates nothing but the closing of the method (Indicated by ” public static void main() “)
  • EIGHTH LINE – (  }  ) These are the closing braces of the class which indicates the end of the class (Indicated by ” public class mydetails “) as well as the program.
Here is the output of the program:-

Getting started with Java - Output of the program.
Output of the program

So , as of now , you all know how to write a program and print some text in Java.

Read Next – Introduction to BlueJ – Writing and Compiling Your Java programs

Following are certain similar examples of making a Java program and printing a piece of text. Don’t miss them for a better understanding of the concept.
  1.  public class post1

                    public static void main()
                                    System.out.println(“  Getting Started With Java  “);
  2.  public class post2

                    public static void main()
                                    System.out.println(“  Introduction to BlueJ  “);
  3.  public class post3

                    public static void main()
                                    System.out.println(“  Operators in Java. “);
  4.   public class information

                    public static void main()
                                    System.out.println(“ Site Name – E – Java Tutorials”);                                 System.out.println(“ Niche – Java Tutorials”);                   }  
It seems that you have got a good answer for the question ” How to print something in Java ” You can use this generic syntax in order to create a simple Java program and print a piece of text in Java
Drop your queries in comments and read the next tutorial about how to How to use BlueJ in order to make your programs easier and to compile them easily.


Post a Comment

Hello Every One thanks For Visit My site You Can Suggest any Idea About site And Related Education Information Provide me Its Best Content For you am Include in this Site And feel free contact And email now I hope This site very help full you