- 1
Which method used to declare " hello"()
void. ()
1 Answer
+ 6
You can write any method to declare hello() like
public void hello() {
//no return type
System.out.print("Hello");
}
public String hello() {
//return String value
return "Hello";
}
you can call these method like this:
hello(); //this is for first hello method
System.out.print(hello()); //this for second hello method.