Professional Documents
Culture Documents
ANS 5:-we can declared a local class inside a static method have access to the instance members of the outer class. The class declared inside a static method can acess to the instance members of the outer class by creating the obj of outer class inside a local class which is inside static method.
int i = 9;
final int k = 6; class MethodLocal { Innerclass obj=new Innerclass(); MethodLocal() { System.out.println(k + obj.i); } } }
} ANS:3-abstract class saleman { char name[20]; int price; void getname(char s[]) { name=s; } void getprice(int x) { price=x; }
} class Productprinter extends Product { void reduceprice() { int c; c=price-500; } void result() {
class Check { public static void main(String args[]) { saleman obj = new Productprinter(); obj.getname(); obj.get_price(); obj.reduceprice(); obj.result(); } }