Java Boiling Water Solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Java Boiling Water Solution

Hey guys! I'm having trouble with the Java boiling water program. This is my code. import java.util.Scanner; public class Program{ public static void main(String[]args){ Scanner sc =new Scanner(System.in); int temp = sc.nextInt; if(temp>=100){ System.out.println("Boiling'"); } else { System.out.println("Not Boiling"); } } } Kindly requesting for assistance.

13th Jul 2023, 8:30 AM
Franklin Okoth
Franklin Okoth - avatar
3 Answers
+ 7
int temp = sc.nextInt(); // missing ()
13th Jul 2023, 9:07 AM
Jayakrishna 🇮🇳
+ 2
Thanks. The code worked ✨
15th Jul 2023, 7:52 AM
Franklin Okoth
Franklin Okoth - avatar
+ 2
Ans correct import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int temp = sc.nextInt(); // Corrected method name if(temp>=100) { System.out.println("Boiling"); }else{ System.out.println("Not boiling"); } } }
19th Feb 2024, 6:09 AM
Irfan Alam
Irfan Alam - avatar