+ 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 Antworten
+ 8
int temp = sc.nextInt(); // missing ()
13th Jul 2023, 9:07 AM
Jayakrishna 🇮🇳
+ 3
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
+ 2
Thanks. The code worked ✨
15th Jul 2023, 7:52 AM
Franklin Okoth
Franklin Okoth - avatar