+ 1

Hey everyone, for below code, please help me to find errors

public class week { public static void main(String[] args) { String days = sun, mon, tue; Int a=11; If (a<10) { System.out.println (sun); } Else { System.out.println(mon); a++; } } }

6th Aug 2017, 6:15 AM
vinay megharaj
vinay megharaj - avatar
1 Resposta
+ 6
1) For String, you have to use "" to initialize new string variable and print with System.out.println(). ex) String s = "msg"; 2) If you want to make array, you have to declare the variable with [] and elements with {}. ex) String[] days = {"sun", "mon", "tue"}; 3) You should use 'int' to declare integer variable, not 'Int'. And for if-else statement, you should use 'if' and 'else', not 'If' and 'Else'. +By convention, the first letter of class is set to capital letter.
6th Aug 2017, 6:49 AM
OrbitHv [Inactive]
OrbitHv [Inactive] - avatar