https://ideone.com/iA4Vg
It's supposed to convert an inputted decimal number to binary but simply won't compile... Any idea why?
Sorry if it's obvious,I only just started learning java
Printable View
https://ideone.com/iA4Vg
It's supposed to convert an inputted decimal number to binary but simply won't compile... Any idea why?
Sorry if it's obvious,I only just started learning java
Please paste the code in code tags, most people won't follow links.
[code]
YOUR CODE HERE
[/code]
Code:Public Class DecToBin
{
public static void main (String[] args) throws java.io.IOException
{
int first=(int)args[0]
int[24] bin
int i=0
int count=23
divide:
bin[i]=(int) first/(2^count)
first=first%(2^count)
i++=
count--=
If count>-1 Then
Goto divide
Endif
System.out.println(bin[])
}}
That won't compile because it's simply not valid Java code and has too many errors to enumerate. You'll need to study Java syntax before you try to create it because the compiler is very unforgiving of errors. You can start here: Learning the Java Language
I realise it has errors, I was just wondering what they are... Like I said,I only just started with java
Like fubar said, there is too much wrong to explain, follow his link.
For starters, statements end with a semi colon(;), you also can't cast a string to int. You also use many non existent words.
Just out of curiosity Domos, are you coming from another language or is this your first programming language? I'm just wondering what you know so far?
Either way, they're right. Your code just screams out I do not know the Java Syntax yet, so that's where you should start. Good luck!