Predict the output of following Java program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Predict the output of following Java program

class T {   int t = 20;   T() {     t = 40;   } } class Main {    public static void main(String args[]) {       T t1 = new T();       System.out.println(t1.t);    } }

7th Jan 2018, 2:40 PM
Mr.Learner
Mr.Learner - avatar
1 Answer
+ 1
40
7th Jan 2018, 2:40 PM
Mr.Learner
Mr.Learner - avatar