How to call method without object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to call method without object

26th May 2018, 3:26 PM
Ankit Raj
Ankit Raj - avatar
11 Answers
+ 1
methodname ();
26th May 2018, 3:40 PM
Shailesh Kodulkar
Shailesh Kodulkar - avatar
+ 1
if the method is in the same class, then call it without the class name
26th May 2018, 3:40 PM
Robert Sokolov
Robert Sokolov - avatar
0
Make the method static?
26th May 2018, 3:31 PM
Robert Sokolov
Robert Sokolov - avatar
0
no
26th May 2018, 3:35 PM
Ankit Raj
Ankit Raj - avatar
0
Why not?
26th May 2018, 3:35 PM
Robert Sokolov
Robert Sokolov - avatar
0
this is tell worng
26th May 2018, 3:36 PM
Ankit Raj
Ankit Raj - avatar
0
😕😕
26th May 2018, 3:37 PM
Robert Sokolov
Robert Sokolov - avatar
0
you write the method is static
26th May 2018, 3:38 PM
Shailesh Kodulkar
Shailesh Kodulkar - avatar
0
ok how to call method form main
26th May 2018, 3:38 PM
Ankit Raj
Ankit Raj - avatar
0
ClassName.methodName();
26th May 2018, 3:39 PM
Robert Sokolov
Robert Sokolov - avatar
0
ok thanks
26th May 2018, 3:39 PM
Ankit Raj
Ankit Raj - avatar