Posts

Showing posts from January, 2024

JAVA THE MAIN METHOD

Image
  The main Method The  main()  method is required and you will see it in every Java program: public static void main ( String [ ] args ) Any code inside the  main()  method will be executed. Don't worry about the keywords before and after main. You will get to know them bit by bit while reading this tutorial. For now, just remember that every Java program has a  class  name which must match the filename, and that every program must contain the  main()  method.       

JAVA SYNTAX

Image
  Java Syntax In the previous chapter, we created a Java file called  Main.java , and we used the following code to print "Hello World" to the screen: public class Main { public static void main ( String [ ] args ) { System . out . println ( "Hello World" ) ; } } Example explained Every line of code that runs in Java must be inside a  class . In our example, we named the class  Main . A class should always start with an uppercase first letter. Note:  Java is case-sensitive: "MyClass" and "myclass" has different meaning. The name of the java file  must match  the class name. When saving the file, save it using the class name and add ".java" to the end of the filename. To run the example above on your computer, make sure that Java is properly installed: Go to the  Get Started Chapter  for how to install Java. The output should be:

TESTCLASS.JAVA

Image
  The program Creation        The Java program can be written using a Text Editor (Notepad++ or NotePad or other editors will also do the job.) or IDE (Eclipse, NetBeans, etc.). FileName:  TestClass.java public   class  TestClass   {   // main method    public   static   void  main(String []args)   {   // print statement    System.out.println( "Hello World is my first Java Program." );   }   }  

JAVA

Image
  History The Java language has a very interesting history. Patrick Naughton, Mike Sheridan, and Jame Gosling, known as the Green team, started the development of Java in the year 1991. These people were the engineers at  Sun Microsystems . In 1996, the first public implementation was released as Java 1.0. The compiler of Java 1.0 was rewritten by Arthur Van Hoff to comply strictly with its specification. With the introduction of Java 2, the new versions have multiple different configurations that have been built for the various platforms. It is worth noting that James Gosling is also known as the father of Java. The ISO standard body was approached by Sun Microsystems in the year 1997 to formalize Java, but the process was withdrawn soon. At one point in time, Sun Microsystems provided most of its implementation of Java available without any cost, despite having the status of proprietary software. Application Programs The Implementation of an application program in Java appli...