Results 1 to 3 of 3
  1. #1
    xlactyu is offline Member
    Join Date
    Oct 2014
    Posts
    9
    Rep Power
    0

    Default jGRASP won't let me declare variables as strings

    This is the code...,

    Java Code:
    import java.util.Scanner;//Imports Scanner
    
    public class operadoreslogicos//imports a public class
    
    {
    
       public static void main (String [] args)//defines the state of a class
       
       {
       
          Scanner input = new Scanner (System.in);//Inputs a scanner to read user
                                              //keyboard
          
          boolean cierto = true,// Declares variables as boolean and applies a value
                  falso = false;
          String hello,
                 bye;
          
                  
          System.out.println("falso && falso = " + (falso && falso));//displays boolean result of false and false
          System.out.println("falso && cierto = " + (falso && cierto));//displays boolean result of false and true
          System.out.println("cierto && falso = " + (cierto && falso));//displays boolean result of true and false
          System.out.println("cierto && cierto = " + (cierto && cierto));//displays boolean result of true and true
          System.out.println("falso || falso = " + (falso || falso));//displays boolean result of false or false
          System.out.println("falso || cierto = " + (falso || cierto));//displays boolean result of false or true
          System.out.println("cierto || falso = " + (cierto || falso));//displays boolean result of true or false
          System.out.println("cierto || cierto = " + (cierto || cierto));//displays boolean result of true or true
          System.out.println("falso &&! falso = " + (falso &&! falso));//displays boolean result of false and not false
          System.out.println("falso &&! cierto = " + (falso &&! cierto));//displays boolean result of false and not true
          System.out.println("cierto &&! falso = " + (cierto &&! falso));//displays boolean result of true and not false
          System.out.println("cierto &&! cierto = " + (cierto &&! cierto));//displays boolean result of true and not true
          System.out.println(hello.equals (bye));
       }//Ends state of class
    }//Ends public class
    The word string is supposed to turn purple when I type it, but it just stays normal, so it doesn't declare hello and bye as variables.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: jGRASP won't let me declare variables as strings

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: jGRASP won't let me declare variables as strings

    Java is case sensitive. I do not see where "string" has been typed into the source. I do see a couple of places where "String" has been typed.

    Do you get a compiler error for the posted code?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 5
    Last Post: 08-20-2014, 10:37 AM
  2. Declare variables inside a for loop?
    By clint.eastwood in forum New To Java
    Replies: 15
    Last Post: 05-02-2012, 10:19 PM
  3. Getting strings from JTextArea into variables
    By TheGadgetCat in forum New To Java
    Replies: 17
    Last Post: 02-01-2011, 03:18 AM
  4. GUI with jGRASP
    By Matt Sakko in forum Other IDEs
    Replies: 0
    Last Post: 03-14-2009, 10:50 AM
  5. How to declare and initalize application space variables
    By thagentleman in forum New To Java
    Replies: 2
    Last Post: 10-11-2008, 07:19 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
  •