Results 1 to 8 of 8
- 06-21-2011, 10:56 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
Can't work out why this won't compile...
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
- 06-21-2011, 11:00 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Please paste the code in code tags, most people won't follow links.
[code]
YOUR CODE HERE
[/code]
- 06-21-2011, 11:12 PM #3
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
Java 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
- 06-21-2011, 11:20 PM #5
Member
- Join Date
- Jun 2011
- Posts
- 3
- Rep Power
- 0
I realise it has errors, I was just wondering what they are... Like I said,I only just started with java
Last edited by Domos123; 06-21-2011 at 11:32 PM.
- 06-21-2011, 11:36 PM #6
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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.
- 06-21-2011, 11:58 PM #7
Senior Member
- Join Date
- Nov 2010
- Posts
- 150
- Rep Power
- 3
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!
-
Similar Threads
-
would this compile?
By stringkilla in forum New To JavaReplies: 10Last Post: 10-24-2010, 03:27 PM -
Can't Compile
By sidk47 in forum JavaServer Pages (JSP) and JSTLReplies: 7Last Post: 06-15-2010, 04:43 PM -
Running .java-files won't work/compile does!(Code inside)
By wyldstyle in forum New To JavaReplies: 6Last Post: 02-06-2009, 08:05 PM -
auto-compile won't work on svn import
By anacapa in forum EclipseReplies: 0Last Post: 10-10-2008, 04:46 PM -
Not able to compile
By bugger in forum New To JavaReplies: 2Last Post: 01-09-2008, 10:13 PM


3Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks