0
How de we pass another class as arguement in main class
6 Antworten
+ 2
what language. what are you trying to do?
+ 2
class mainClass{
public static void main(..){
MyClassName obj = new MyClassName();
function(obj);
}
void function(ClassName obj){
}
}
+ 1
main function signature is fixed by the language.
+ 1
In any lang main function is the first function that is executed but in java we have static method that can be executed first than main function.
u cannot pass another class as argument to the main class.
pls share the scenario why u need to pass another class as argument.
+ 1
thnks evry1 i got it
+ 1
ok