2 Answers
New Answerhi, void is a class in java but u can't initialize the class like void v=new void()//wrong. It represents the return type of function or methods which will return nothing to the calling function class sample { void display(int a,int b) { c=a+b; System.out.println("sum"+c); } public static void main(String ar[]) { sample s=new sample(); s.display(10,20); } } which will display sum of two numbers and it return nothing to the calling function.
Learn Playing. Play Learning
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message