M
mhk
Hi ,
i cannot create instance of parent class ( test1.java ) in my derived
class (test2.java ) while using package.
if i dont use package then it prints "value = 3" but i want it to work
with package. The error is that "test2.java" doesn't know about
"test1.java" while using package.
can anyone help in solving this problem.
Thanks and here is the sample code below.
test1 class "test1.java" is
---------------------
package search;
public class test1
{
public test1() {}
public int val1()
{
return(3);
}
}
AND MY 2nd class is "test2.java"
-----------------------------------
package search;
public class test2 extends test1
{
public test2() {}
public static void main(String[] args)
{
test1 t = new test1();
System.out.println ("value = "+ t.val1() );
}
}
***************************************
i cannot create instance of parent class ( test1.java ) in my derived
class (test2.java ) while using package.
if i dont use package then it prints "value = 3" but i want it to work
with package. The error is that "test2.java" doesn't know about
"test1.java" while using package.
can anyone help in solving this problem.
Thanks and here is the sample code below.
test1 class "test1.java" is
---------------------
package search;
public class test1
{
public test1() {}
public int val1()
{
return(3);
}
}
AND MY 2nd class is "test2.java"
-----------------------------------
package search;
public class test2 extends test1
{
public test2() {}
public static void main(String[] args)
{
test1 t = new test1();
System.out.println ("value = "+ t.val1() );
}
}
***************************************