- 3

It still show me 1 error

import java.util.Scanner; //your code goes here public class Converter{ static int toBinary (){ String binary=""; int num; while (y>0){ binary = (y%2)+binary; y/=2; return num; } } } public class Program { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int x == int y; System.out.print(Converter.toBinary(x)); } }

4th Jul 2022, 2:28 PM
MR KINGSHOW
MR KINGSHOW - avatar
1 Answer
+ 5
You can continue in your last same post.. Why you need another dublicates one..? if it not helped, then you can delete one.., to avoid dublicates.. int x == int y ; is invalid statement.. **read about variable and its initialization a bit more.. You are passing x to toBinary method but not catching it.. For => toBinary(x) , the method definition must be like toBinary (int y) { // you are using y , so .. } Not toBinary() { .. } **read about methods in java.. **read about return in method.. You have logic flaws also.. So before attempting, a bit more revise the topics.. You need to see some example, how to write correct syntax and logic.. https://www.sololearn.com/discuss/3055447/?ref=app
4th Jul 2022, 2:39 PM
Jayakrishna 🇼🇳