Drag and drop from the options below to create an object of the A class in the B class and call it's "test" method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Drag and drop from the options below to create an object of the A class in the B class and call it's "test" method.

this is the question which has challenged me I have tried the possible dragging but am still getting a wrong answers

19th Dec 2019, 4:12 PM
Gibson S.B Kasanga
Gibson S.B Kasanga - avatar
4 Answers
+ 4
I can't understand what should I drag and where should I drop because I can't see that code. Gibson S.B Kasanga , please if you need help you should explain your problem to make it understandable for others. currently it has no enough information to guide you. Please take a screenshot of question or right down question here.You can share screenshot using feed or any online storage (drive, dropbox etc)
19th Dec 2019, 5:00 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
Gibson S.B Kasanga , We need to use class keyword to declare any class. so first blank will be filled with `class`. now next class B contains main method. In this main method you have to create an object of class A, which we have defined previously. In general we make object like this: ClassName objName=new ClassName(); As we have to create object of class A fill blank with `A`. then next blank with `new` keyword. new will allocate memory for your object. now next we have to call method(named test() ) of our newly created object (whose name is obj) to call *instance methods* general syntax is: objectName.methodName(); so fill blank with `test()` which is name of method. Always remember that if you can't solve any quiz on sololearn means you haven't understood what was taught. So please revise all concepts not only by reading and filling in blanks but by writing actual codes. Don't limit yourself to this app, learn from everyone, everywhere in the way you find better for you. Good luck!
19th Dec 2019, 5:35 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
oh sorry this is the : public________A{ public void test (){ System. out.println("Hi"); } } class B{ public static void main(string args[]){ __________ obj=___________ A(); obj._________; } } these are options object class B A new create test()
19th Dec 2019, 5:10 PM
Gibson S.B Kasanga
Gibson S.B Kasanga - avatar
0
Thanks
19th Dec 2019, 6:00 PM
Gibson S.B Kasanga
Gibson S.B Kasanga - avatar