+ 1
Anyone who is well acquainted in java can please let me know if my understanding is ok by judging the comment lines?
class Robot { int id; Robot(int i) {//calling the constructor id = i;//assigning variable Brain b = new Brain();//declaring object b.think();//calling a method to be applied on object b of class Brain } private class Brain {//declaring an inner class public void think() {//calling the method to define it System.out.println(id + " is thinking");//defining the method } } } public class Program {//inner class public static void main(
2 Réponses
+ 1
https://code.sololearn.com/cmW4ftQTd2cz/?ref=app.
you can check in here