Preview:
public static void main(String[] args) {
 //Basic set up.
}

//Print in the console.
System.out.println("Printing String...");

//Basics.
- Pink letters are keywords. ( public, static, class, void... )
- Compiler will always start with the 'main' mathod.      
- use ';' after each line of code.
- 'void' is the basically how we tell that we returning nothing. if we want to return a number? then mention 'int' instead of 'void'.                              
                              
                              
                              
int a = 10;
// 'int' is Integer.

String name = "Karan";
// 'String' is string.    
                              
 ----------------------------
             // Transfer data/methods within classes.
 
  public class Parent {
   // This is the parent Class.    
    public static void main(String[] args){
    
     Methods m = new Methods;
     //Methods is the class name.
     // 'm' is the oject.
    
     m.ValidateHeader(); 
     // 'm.' will provide 'built in' and custom methods             available in the 'Methods' class.
    
     m.ValidateFooter();
     // It will return 'Done Amigo' as programed in method. 
     }                           
  }                              
                              
  
 publick class Methods {
    //This is the 'Methods' class ( child class)
   // We won't be using 'main' method here as we are just            sending the data.
    
     public void ValidateHeader(){
      //Example of an Method.    
      // 'void' since we are not returning anything. 
    }
     public String ValidateFooter(){
      //Example of an Method.    
       // 'String' as we are returning string
        return "Done amigo"  
    }
     public int ValidateFooter2(){
      //Example of an Method.    
        return 200;  
    }
  }                             
                              
-----------------------------                          
                              
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter