Results 1 to 11 of 11
Thread: Illegal start of expression
- 02-28-2011, 12:34 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
Illegal start of expression
I'm getting "Illegal start of expression" error at the last line of the code
the error is in this lineJava Code:import javax.swing.*; public class Numeros { public static void main (String args[]) { int a, b, c; a = Integer.parseInt(JOptionPane.showInputDialog("Digite o primeiro número")); b = Integer.parseInt(JOptionPane.showInputDialog("Digite o segundo número")); c = Integer.parseInt(JOptionPane.showInputDialog("Digite o terceiro número")); JOptionPane.showMessageDialog("Os números digitados foram: " +a+ " " +b+ " " +c+); } }
ThanksJava Code:JOptionPane.showMessageDialog("Os números digitados foram: " +a+ " " +b+ " " +c+);
- 02-28-2011, 02:01 AM #2
Senior Member
- Join Date
- Jan 2011
- Location
- Bangalore, India
- Posts
- 102
- Rep Power
- 0
First of all Java API says this :
showMessageDialog(Component parentComponent, Object message)
Here you try to give only one argument.
One more. Remove the "+" in the last line after "c"
- 02-28-2011, 11:51 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
- 02-28-2011, 11:54 PM #4
Argument/parameter is the values inside the round brackets that you pass to a method.
The String "hello" is the argument to the println method.Java Code:System.out.println("hello");
- 03-01-2011, 12:37 AM #5
Member
- Join Date
- Feb 2011
- Posts
- 8
- Rep Power
- 0
Have you tried this?
Java Code:JOptionPane.showMessageDialog([COLOR="Red"]null[/COLOR], "Os números digitados foram: " +a+ " " +b+ " " +c);
- 03-01-2011, 05:18 PM #6
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
- 03-01-2011, 05:51 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,386
- Blog Entries
- 7
- Rep Power
- 17
Don't ignore reply #2; it tells you exactly what is wrong with your code.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-02-2011, 11:24 PM #8
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
- 03-02-2011, 11:46 PM #9
Well, from that wealth of information I'm sure someone knows what the problem is. Or perhaps you can post the latest version of your code and fully explain what happens. Error messages? Then copy and paste the EXACT error message. Incorrect behviour? Then explain what does happen and what you want to happen instead.
- 03-04-2011, 12:20 AM #10
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
Ok, here´s the exact code:
and the error is :Java Code:import javax.swing.*; public class Numeros { public static void main (String args[]) { int a, b, c; a = Integer.parseInt(JOptionPane.showInputDialog("Digite o primeiro número")); b = Integer.parseInt(JOptionPane.showInputDialog("Digite o segundo número")); c = Integer.parseInt(JOptionPane.showInputDialog("Digite o terceiro número")); JOptionPane.showMessageDialog(null,"Os números digitados foram: " +a+ " " +b+ " " +c); } }
illegal start of expression - line 10
- 03-04-2011, 12:23 AM #11
Member
- Join Date
- Feb 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Illegal start of expression
By Basit56 in forum New To JavaReplies: 2Last Post: 08-18-2009, 09:12 AM -
Illegal Start of an Expression
By ddatta8 in forum New To JavaReplies: 3Last Post: 12-20-2008, 08:40 PM -
Illegal Start of Expression
By vince425 in forum New To JavaReplies: 3Last Post: 10-18-2008, 07:41 AM -
illegal start of expression
By razmyasdfg in forum CLDC and MIDPReplies: 2Last Post: 07-27-2008, 10:44 PM -
Illegal start of expression
By gabriel in forum New To JavaReplies: 2Last Post: 08-01-2007, 05:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks