Calling Method public static void main(String[] args) { methodname(); }
Calling Method public static void main(String[] args) { sayHello(); }
Comments // This is a single line comment /* This is a multi-line comment you can comment here too!! */
Variable Scoping Global Variable Are variables declared within a class, it can be accessed within a whole class. Local Variable Are variables declared inside a method, condition, loops and any other block of code, it can be accessible within that block of code.
Arguments / Parameters A value that needs to be passed on a method so that the method can use value and perform various operations on it. PS: You can have as many Arguments / Parameters as you want, they act as a Local variable inside a method/function.
Method with Arguments modifiers returntype methodName(arguments) { //Do anything here }
Method with Arguments static void say(String word) { System.out.println(word); }
Return Keyword return keyword is used to return a value from the method. It is used when a method has a result. Example: A method that performs Math equations. A method that concatenates Strings.
Return Type The type of the value that will be returned, return type are same as the datatypes. void returns Nothing. int returns integers. String return strings. And so on……