ExamQuestions.com

Register
Login
Java SE 8 Programmer II Exam Questions

Oracle

Java SE 8 Programmer II

35 / 130

Question 35:

Given the definition of the Vehicle class: class Vehicle{ String name; void setName (String name){ this.name = name; } String getName(){ return name; } } Which action encapsulates the Vehicle class? 

Answer options:

A. Make the Vehicle class public.
B. Make the name variable public.
C. Make the getName method public.
D. Make the name variable private.
E. Make the setName method private.
F. Make the getName method private.