Compile time error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Mar 2020, 8:08 PM
Avinash Giri
Avinash Giri - avatar
18 Answers
+ 2
Thanx for clear my doubts Sheetal Malavade 😊
24th Mar 2020, 9:52 AM
Avinash Giri
Avinash Giri - avatar
+ 2
Avinash Giri Sure 👍
24th Mar 2020, 10:13 AM
Sheetal Malavade
+ 1
Avinash Giri , your variables x and y are not initialized. You can give them a value or use Scanner to ask user to input something.
23rd Mar 2020, 8:14 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Avinash Giri , what is the purpose of your code?
23rd Mar 2020, 8:55 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
24th Mar 2020, 10:18 AM
Avinash Giri
Avinash Giri - avatar
+ 1
class name should start with capital letter and also variable x is undeclared
25th Mar 2020, 6:06 AM
Kavya
Kavya - avatar
+ 1
make the class name as Debugging instead of debugging because java allows class names which start with a capital letter
25th Mar 2020, 6:28 PM
Kavya
Kavya - avatar
0
declare the x value
23rd Mar 2020, 8:25 PM
Baci
Baci - avatar
0
But condition is not apply if I give x=3 they give me y =3 but don't check if conditionTheWh¡teCat 🇧🇬 Baci
23rd Mar 2020, 8:32 PM
Avinash Giri
Avinash Giri - avatar
0
What happens when x= 3 they fulfil the condition. (x>10)TheWh¡teCat 🇧🇬
23rd Mar 2020, 8:57 PM
Avinash Giri
Avinash Giri - avatar
0
It's not clear what is the idea of your code, Avinash Giri.
23rd Mar 2020, 9:03 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Put the x value in y but use if TheWh¡teCat 🇧🇬 plzz clear my doubt
23rd Mar 2020, 9:12 PM
Avinash Giri
Avinash Giri - avatar
0
It's not clear, only you know what do you want to do with your code, but you don't explain it, Avinash Giri.
23rd Mar 2020, 9:19 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Plzzz explain it I see this question in my book so I try to solve thisTheWh¡teCat 🇧🇬
23rd Mar 2020, 9:30 PM
Avinash Giri
Avinash Giri - avatar
0
import java.util.*; // Compiler version JDK 11.0.2 import java.util.Scanner; class debugging { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int x= sc.nextInt(); int y; if (x<10) { y = x; } System.out.println(" Value of Y = "+x); } } Now code is right plzz explain output TheWh¡teCat 🇧🇬
23rd Mar 2020, 9:31 PM
Avinash Giri
Avinash Giri - avatar
0
Avinash Giri the logic you have written in this program will take input X from user and checks whether it's less than 10 or not.. there is one correction in your last printf statement.. that is if you want y data to be displayed then change your code to System.out.println("value of Y = " + y ) .. but you have written X there .. program will works like this .. 1. if it's less than 10 , then it will enter into if block and assigns X value to y . (y=X) and prints the same output. 2.if X is greater than 10 suppose X= 15 , then it is false and skips the if block. and program control jumps to print statement.. he there is a small mistake would occur .. when the X value is greater than 10 , it wil never enter the if block and there wont be any value assigned to y.. and program control jumps to print statement.. since you have not initiatialised y variable in the beginning , hence it will throw error .. so 1st assign value to y so that it can print the default y value when X > 10..
24th Mar 2020, 8:06 AM
Sheetal Malavade
0
Variable x is not declared
24th Mar 2020, 10:48 AM
RAJDEEP DABRAL
RAJDEEP DABRAL - avatar
0
Hello Giri I want you to help me
25th Mar 2020, 9:49 AM
Mukeshimana Eric
Mukeshimana Eric - avatar