+ 1
What happens if static is not written while declaring a method?
If im just typing void fn_name() Will it show any error? If yes, why is that?
1 Antwort
+ 6
Actually, no error will occur.
To call that method, you need to create instance of a class.
class Student {
public static void main (String[] atgs){
Student std= new Student();
std.f n_Name();
}}