Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Class Text not found in type declaration or import.

  Asked By: Holly    Date: Apr 18    Category: Java    Views: 954
  

i am a new user of java.when i write a program in which i import trhr Text
class,altough i compile it without any error,when i wanna run it,it says:

Class Text not found in type declaration or import.

import Text;

can you help me?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Miriam Green     Answered On: Apr 18

I dont think you have to import  classes from the same package... i never
had to though...

but you should make sure the package declaration  of classes in the same
folder look the same... i've had the compiler (or even runtime? i'm not
sure ...) complain about that when i've moved classes around and forgot to
check the package declaration.

 
Answer #2    Answered By: Alberta Miller     Answered On: Apr 18

my problem remains unsolved.when i try with import  java.Text.*; the compiler
says:expo.java [2:1] Package java.Text. not found  in import.
import java.Text.*;

and when i try with import org.w3c.dom.Text; it says:

expo.java [11:1] Cannot use operator new for this type
Text cin=new Text();
^
expo.java [11:1] Cannot parse initializer
Text cin=new Text();
^
expo.java [13:1] No method found matching readDouble()
x=cin.readDouble();


here is my program:

import java.io.*;
import Text;
class expo
{
public static void main(String args[]) throws IOException
{
double factor,us,expo,x;
factor=1;
us=1;
expo=1;
Text cin=new Text();
System.out.println("please enter a number");
x=cin.readDouble();
for(double sayi=1;sayi<=200;sayi++)
{ factor*=sayi;
us*=x;
expo+=us/factor;
}
System.out.println("the exponent of your number is="+expo);
}
}

 
Answer #3    Answered By: Debbie Reyes     Answered On: Apr 18

First u can't import  java.Text.* because it's not
exist (no package in java  start in Capital latter, and
there is no package provide by java called java.Text).
And about the 2nd class  org.w3c.dom.Text it's
interface and for sure u can't create object from
interface.

Can I ask you something: why u needs this class Text?

 
Didn't find what you were looking for? Find more on Class Text not found in type declaration or import. Or get search suggestion and latest updates.




Tagged: