in this program. what is the problem in class "mz " | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

in this program. what is the problem in class "mz "

public class Dir { public static void main(String []args) { int a=10,b=20; if (10<20) { System.out.println("this is first statement"); System.out.println("this is second statement"); } else{ System.out.println("this is else statement"); } class Mz{ int h=30; System.out.println(h); } } }

26th Mar 2019, 1:15 PM
aminul islam hnc
aminul islam hnc - avatar
1 Answer
+ 2
public class Dir { public static void main(String args []) { int a=10,b=20; if(10<20) { System.out.println("first statement"); System.out.println("second statement"); } else { System.out.println("else statement"); } // till this all was right but after this you forgot to close the class and function... } }// End of class Dir // Now it is closed... // Now your Mz class will start... class Mz { // In question there is no function method... // It should be there... public static void main(String args []) { int h=30; System.out.println(h); } }// End of class Mz
27th Mar 2019, 10:10 AM
mn121
mn121 - avatar