Results 1 to 3 of 3
- 09-24-2012, 07:10 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 68
- Rep Power
- 0
It keeps trying to get me to close parentheses...
Ok so this is really hard to explain. Ive already asked a question on here about a hour ago so i hope i dont get hate from mods for posting again so soon (or other peopl) but this one is just weird. ive wrote the code correctly but when i try to ad " " to put a space between the variables i want it to print it trys to make me put a ) by the varriable which screwes every thing up
whenever i try to compile it says " ')' expected right next to the variable that is before the " "Java Code:import java.util.Scanner; public class Prog72a { public static void main(String args[]) { int a,b,c,d; Scanner aa = new Scanner(System.in); System.out.println("imput the first two numbers"); a = aa.nextInt(); Scanner bb = new Scanner(System.in); System.out.println("imput the second two numbers"); b = bb.nextInt(); Scanner cc = new Scanner(System.in); System.out.println("imput the third two numbers"); c = cc.nextInt(); Scanner dd = new Scanner(System.in); System.out.println("imput the fourth two numbers"); d = dd.nextInt(); int f = ((a + b + c + d) % 26)+65; char g = (char) f; System.out.println("The correct number and code is " + a " " + b " " + c " " + d " " + g);
- 09-24-2012, 07:47 AM #2
Member
- Join Date
- Jul 2012
- Posts
- 9
- Rep Power
- 0
Re: It keeps trying to get me to close parentheses...
System.out.println("The correct number and code is " + a + " " + b + " " + c + " " + d + " " + g);
The above statement is the right way to use it. Don't forget to close your parenthesis at the end.
- 09-24-2012, 07:54 AM #3
Member
- Join Date
- Sep 2012
- Posts
- 68
- Rep Power
- 0
Similar Threads
-
The increment operator with parentheses
By 357mag in forum New To JavaReplies: 2Last Post: 07-03-2011, 07:58 PM -
matching parentheses stack
By msa0127a in forum New To JavaReplies: 9Last Post: 10-05-2010, 10:37 PM -
Using regex to retrieve all text inside parentheses
By adhoc334 in forum Advanced JavaReplies: 5Last Post: 08-18-2010, 08:05 PM -
Will the connection.close() and statement.close() ever be called???
By Stephen Douglas in forum New To JavaReplies: 13Last Post: 04-09-2010, 11:15 AM -
close to zero
By nokicky in forum New To JavaReplies: 6Last Post: 10-26-2009, 04:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks