+ 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(

26th Oct 2017, 5:53 AM
Adrija Ray Chaudhuri
Adrija Ray Chaudhuri - avatar
2 Réponses
26th Oct 2017, 6:14 AM
Adrija Ray Chaudhuri
Adrija Ray Chaudhuri - avatar