Method in java, Simple void method Example other than main
Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)
1055Program:
public class ExampleVoidMethod { public static void main(String[] args) { methodmarks(92.7); } // The void keyword allows us to create methods which do not return a value. public static void methodmarks(double marks) { if (marks <= 100) { System.out.println("Rank:outstanding"); }else if (marks <= 82.4) { System.out.println("Rank:excelent"); }else { System.out.println("Rank:others"); } } }
Output:
Rank:outstanding Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.