Java - Encapsulation
Which of the following is the correct way to declare a private variable in a Java class?
class Person {
? String name;
}Which of the following is the correct way to declare a private variable in a Java class?
class Person {
? String name;
}private to hide them inside the class.private hides the variable from outside access, others allow wider access.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions