Results 1 to 3 of 3
  1. #1
    MrPosotive is offline Member
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    0

    Default 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

    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);
    whenever i try to compile it says " ')' expected right next to the variable that is before the " "

  2. #2
    java.java is offline Member
    Join Date
    Jul 2012
    Posts
    9
    Rep Power
    0

    Default 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.

  3. #3
    MrPosotive is offline Member
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    0

    Default Re: It keeps trying to get me to close parentheses...

    thanks man

Similar Threads

  1. The increment operator with parentheses
    By 357mag in forum New To Java
    Replies: 2
    Last Post: 07-03-2011, 08:58 PM
  2. matching parentheses stack
    By msa0127a in forum New To Java
    Replies: 9
    Last Post: 10-05-2010, 11:37 PM
  3. Using regex to retrieve all text inside parentheses
    By adhoc334 in forum Advanced Java
    Replies: 5
    Last Post: 08-18-2010, 09:05 PM
  4. Replies: 13
    Last Post: 04-09-2010, 12:15 PM
  5. close to zero
    By nokicky in forum New To Java
    Replies: 6
    Last Post: 10-26-2009, 05:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •