T
the clansman
I have an Applet and somewhre in my code, I'd like to have a String variable
value changed by another method. The code looks like below. The compiler
returns the following error:
-------------
"BasicApplet.java:107: incompatible types"
"found :test
required: java.lang.String
cString =new test();
1 error
-------------
import javax.swing.*;
....
....
import java.lang.String;
....
....
class myFrame extends JFrame
{
...
private String cString ;
myFrame( )
{
cString =new test();
}
}
class test
{
String cValue;
String test()
{
cValue = new String( "hello" );
return( cValue );
}
}
value changed by another method. The code looks like below. The compiler
returns the following error:
-------------
"BasicApplet.java:107: incompatible types"
"found :test
required: java.lang.String
cString =new test();
1 error
-------------
import javax.swing.*;
....
....
import java.lang.String;
....
....
class myFrame extends JFrame
{
...
private String cString ;
myFrame( )
{
cString =new test();
}
}
class test
{
String cValue;
String test()
{
cValue = new String( "hello" );
return( cValue );
}
}