Print 12 and 13 table only 12*1 12*2and same for 13 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Print 12 and 13 table only 12*1 12*2and same for 13

Nested loops java

24th Nov 2021, 10:59 AM
Sukhneek Kaur
8 Answers
+ 3
Your main() method is invalid. A main() method should be specified as `static` method, and receives only one `String[]` as argument. After fixing that, you'd also have to initialise <a> and <b> locally in main() because your instance variables <a> and <b> cannot be accessed from a `static` method.
24th Nov 2021, 11:24 AM
Ipang
24th Nov 2021, 11:00 AM
Sukhneek Kaur
+ 1
Use static keyword in main function
24th Nov 2021, 11:25 AM
Atul [Inactive]
+ 1
And write String args[] instead of declaration of variables
24th Nov 2021, 11:26 AM
Atul [Inactive]
+ 1
Try... public class Program { public static void main (String[] args) { for (int a=12;a<=13;a++) { for (int b=1;b<=2;b++) { System.out.println(a+"*"+ b +"="+a*b); } } } }
24th Nov 2021, 12:05 PM
Paul K Sadler
Paul K Sadler - avatar
0
Check this answer
24th Nov 2021, 11:00 AM
Sukhneek Kaur
0
Please always tag the language you're asking about. https://code.sololearn.com/W3uiji9X28C1/?ref=app
24th Nov 2021, 6:46 PM
Simon Sauter
Simon Sauter - avatar
0
Oky thank you everyone for helping me in this course
25th Nov 2021, 1:15 PM
Sukhneek Kaur