Let’s celebrate , we have completed the first phase of our Java course. Till now we have learned the theory part of the basic program structure , without a class , method , variables and println() method a  java program is incomplete. Here the summary of your credit of learning.


Java – Class

  • In Java a class is created by opening and closing curly braces ‘{ }’
  • A class will have fields , method and constructors.
  • Every word in a class name should start with a capital letter. “MyProgram”
  • A Java program can consists of one or more class , but only one main method per application.

Java – Methods

  • Java methods are created by opening and closing curly braces.
  • A method can have arguments inside the parenthesis.For example : myMethod(int x) { code }
  • Every method name in Java should start with a small letter and then followed my capital letter of the next word.
  • Every method should have return type.
  • ‘main()’ is the method where the Java program starts.
  • A method is alose considered as a block. 

Java – Data types

  • Data types are used to declare a variable. 
  • Data types are of two categories : Primitive type and Reference type
  • Primitive type are the one we use for declaring variables like int x , float f.
  • Reference type are the one we use to declare reference variables using a class or interface.

Java – Variable declaration

  • A variable is declared by the use of data types 
  • For example int x ; this is called declaration.
  • int x=10 ; this is called initialization.
  • Variables are of two types instance variables and local variables.
  • Variables which are declared inside the method parenthesis are called arguments.

Java – Displaying output

  • To display the output of the program we use ‘pritln()’ method.
  • println method is an overloading method.
  • Different println overloading methods are used for different purposes.
  • It is the pre-defined method of PrintStream class belongs to package.

Now let’s move on to the practice examples of what you have learned so far.


2 thoughts on “Summary

Leave a Reply

Your email address will not be published. Required fields are marked *