Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Submission 1 (0 points) Which of the following can be accessed (without casting)

ID: 3863000 • Letter: S

Question

Submission 1 (0 points) Which of the following can be accessed (without casting) from a method of superclass S? A protected variable declared in S's subclass T M A public variable declared in subclass T M A private variable declared in subclass T A protected variable declared in S Submission 2 (01 points) Which of the following can be accessed (without casting) from a method of superclass S? Aprotected variable declared in S's subclass T M A public variable declared in subclass T M A private variable declared in subclass T V A protected variable declared in S Submission 3 (01 polnts) which of the following can be accessed (without casting) from a method of superclass S? A protected variable declared in S's subclass T M A public variable declared in subclass T A private variable declared in subclass T V A protected variable declared in s Submission 4 (011 points) Which of the following can be accessed (without casting) from a method of superclass S? MA protected variable declared in S's subclass T M A public variable declared in subclass T A private variable declared in subclass T M A protected variable declared in S Thursday, March 16 2017 09:45 PM EDT Thursday, March 16 2017 09:46 PM ED Thursday, March 16 2017 DB:50 PM Thursday, March 16 2017 09:57 PM EDT

Explanation / Answer

Answer is B: A public variable declared in subclass T.: We can access other class's members only if the members are public.

package sample1.s;

import sample1.t.T;

public class S {
void methodS(){
System.out.println("In Method S");
T t = new T();
t.methodT();
}
}

package sample1.t;

import sample1.s.S;


public class T extends S{
public void methodT(){
System.out.println("In method T");
}
}