DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Text

  1. #1
    Mus Guest

    Text


    I try to compile the code above, but compiler cannot resolve symbol Text.
    Anybody know the reason?
    Thanks.

    import java.io.*;
    import Text;

    public class IfEx {
    public static void main (String args[])
    {
    double Not;
    Text cin=new Text();
    System.out.println("..>");
    Not=cin.readDouble();
    if (Not==90)
    System.out.println("ok.");
    else
    System.out.println("not ok.");
    }
    }

    Errors;
    IfEx.java:2: cannot resolve symbol
    symbol: class Text
    import Text;
    ^
    IfEx.java:9: cannot resolve symbol
    symbol : class Text
    location: class IfEx
    Text cin=new Text();
    ^
    IfEx.java:9: cannot resolve symbol
    symbol : class Text
    location: class IfEx
    Text cin=new Text();
    ^
    3 errors

  2. #2
    Paul Clapham Guest

    Re: Text

    Text.class is not in your classpath. (By the way, you should not have to
    import a class that is in the default package like that.)

    PC2

    "Mus" <mu@hotmail.com> wrote in message news:3caac1ac$1@10.1.10.29...
    >
    > I try to compile the code above, but compiler cannot resolve symbol Text.
    > Anybody know the reason?
    > Thanks.
    >
    > import java.io.*;
    > import Text;
    >
    > public class IfEx {
    > public static void main (String args[])
    > {
    > double Not;
    > Text cin=new Text();
    > System.out.println("..>");
    > Not=cin.readDouble();
    > if (Not==90)
    > System.out.println("ok.");
    > else
    > System.out.println("not ok.");
    > }
    > }
    >
    > Errors;
    > IfEx.java:2: cannot resolve symbol
    > symbol: class Text
    > import Text;
    > ^
    > IfEx.java:9: cannot resolve symbol
    > symbol : class Text
    > location: class IfEx
    > Text cin=new Text();
    > ^
    > IfEx.java:9: cannot resolve symbol
    > symbol : class Text
    > location: class IfEx
    > Text cin=new Text();
    > ^
    > 3 errors




  3. #3
    Ramsin Guest

    Re: Text


    From what I can tell you are trying to read a integer from a user. in the
    java.io package there is a class called BufferedReader which can be used
    here for example to read an integer from a user
    ....
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    and then
    String read = reader.readLine();
    now you have read a string. You will need to make the string into a int like
    this:
    int read_int_value = Integer.parserInt(read);
    now you can go
    if ( read_int_value == 90 )
    System.out.println("ok.");
    else
    System.out.println("not ok.");

    There will be problems if you use this code and do not actually check that
    the user supplied an integer to begin with. Integer.parseInt throws a NumberFormatException
    which will indicate the user did not supply a integer you should probably
    catch this using a try catch block and do what needs to be done.



    "Mus" <mu@hotmail.com> wrote:
    >
    >I try to compile the code above, but compiler cannot resolve symbol Text.
    >Anybody know the reason?
    >Thanks.
    >
    >import java.io.*;
    >import Text;
    >
    >public class IfEx {
    >public static void main (String args[])
    > {
    > double Not;
    > Text cin=new Text();
    > System.out.println("..>");
    > Not=cin.readDouble();
    > if (Not==90)
    > System.out.println("ok.");
    > else
    > System.out.println("not ok.");
    > }
    >}
    >
    >Errors;
    >IfEx.java:2: cannot resolve symbol
    >symbol: class Text
    >import Text;
    >^
    >IfEx.java:9: cannot resolve symbol
    >symbol : class Text
    >location: class IfEx
    > Text cin=new Text();
    > ^
    >IfEx.java:9: cannot resolve symbol
    >symbol : class Text
    >location: class IfEx
    > Text cin=new Text();
    > ^
    >3 errors



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center