In this Java tutorial I am going to show you how to create a simple program using Java Class method. Class methods are those that do not need an object instance in order to be used, and they will use the static keyword in their specifier. Alright, without wasting any of your time, lets take a look at one of the below example.
public class Hi {
public static void main(String[] args) {
sayHi();
System.out.println("The second Hi!!");
}
public static void sayHi() {
System.out.println("The first Hi!");
}
}
In above example I am creating a method which will print out the phrase ‘The first Hi!’ on the screen. If you compile and run the file then you will see the following outcome.
Next Page :
Javascript replace method reviewJavascript replace method review
How to use Java Scanner ClassThis article will show you how to use Java Scanner Class with simple Java code.
Show text on JFrame with Java programShow text on JFrame with Java program!
The if…else statement in Java program‘The if…else statement in Java program’ article will show you an example to use the statement.
Java Scanner ClassJava Scanner class tutorial will show you how to create an instance of the scanner class and read in the input from the user then print out the sum of those inputs.
Creating and Using Interfaces in Java ProgramCreating and Using Interfaces in Java Program will show you how to write simple java program using Interfaces.
