Special Offer - Enroll Now and Get 2 Course at ₹25000/- Only Explore Now!

All Courses
Java Class Method

Java Class Method

May 1st, 2019

Java Class Method

Methods are set of executable codes , which have implemented with and without return type. Method will return the value based on the use case.


package dkp.week3;
public class MethodExample {  
       public static void sumNumber1(int a,int b) {    
              System.out.println("Void Method"+(a+b));
       public static int sumNumber2(int a,int b) {           
       public static void main(String[] args) {
              // TODO Auto-generated method stub
              int c;          
              System.out.println("Int Method:"+c);

Sample output:

Int Method:30
Void Method30