Hi Guys,
Could you pls tell me whats wrong in my code ? Any help really appreciated.
package spack;
class A
{
public int a = 10;
protected int b = 20;
int c =30;
private int d = 40;
public void printa()
{
System.out.println("value of public variable in Class A is " + a);
System.out.println("value of protected variable in Class A is " + b);
System.out.println("value of default variable in Class A is " + c);
System.out.println("value of private variable in Class A is " + d);
}
}
public class B
{
public void printab()
{
System.out.println("value of public variable from class A in class B is " +a);
System.out.println("value of protected variable from class A in class B is" + b);
System.out.println("value of default variable from class A in class B is " +c);
System.out.println("value of private variable from class A in class B is " +d);
}
public static void main(
String args[])
{
B bex = new B();
bex.printab();
}
}
when I compiled, it gave the following errors......
Cannot find symbol a,b,c and d
Waiting for your Answers with explanation