|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help with - illegal character: \160
I'm an absolute absolute newbie both to programming and java. I'm trying to learn to program in java on an iMac 400Mhz 320mb ram using mac os x 10.3.4
i was trying a simple program called NineSquares, i've put the code and the error message of illegal character: /160 below. any help would be highly appreciated. thank you, Ujwala package NineSquares; import javax.swing.JFrame; public class NineSquares { * public static void main( String args[]) { ** JFrame = myFrame = new JFrame("Nine Squares"); ** myFrame.setVisible(true); ** myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CL OSE); *} } and the error message i keep getting is -bash-2.05b$ javac firstone/NineSquares.java firstone/NineSquares.java:7: illegal character: \160 ?public static void main( String args[]) ^ firstone/NineSquares.java:9: illegal character: \160 ??JFrame = myFrame = new JFrame("Nine Squares"); ^ firstone/NineSquares.java:9: illegal character: \160 ??JFrame = myFrame = new JFrame("Nine Squares"); ^ firstone/NineSquares.java:10: illegal character: \160 ??myFrame.setVisible(true); ^ firstone/NineSquares.java:10: illegal character: \160 ??myFrame.setVisible(true); ^ firstone/NineSquares.java:11: illegal character: \160 ??myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE); ^ firstone/NineSquares.java:11: illegal character: \160 ??myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE); ^ firstone/NineSquares.java:12: illegal character: \160 ?} ^ firstone/NineSquares.java:13: <identifier> expected } ^ 9 errors -bash-2.05b$ |
|
#2
|
||||
|
||||
|
Should your main() function be inside your class? That's typically outside a class, isn't it? An error like that (assuming it is an error) is the sort of thing that could cascade down and cause a whole bunch of errors like what you've got here.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
actually, the main-method must be within a class.
but on to the various things i see: the '*' shouldn't be there. and 'JFrame = myFrame = new JFrame("Nine Squares");' should be 'JFrame myFrame = new JFrame("Nine Squares");' There should be no '=' at that point. other than that, i see no errors.
__________________
Benjamin Horsleben horsleben.com/benjamin Don't blame malice for what stupidity can explain |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > help with - illegal character: \160 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|