009-002-005
Public Modifier: Accessing Public Fields
Easy
Problem Description
Public Modifier: Accessing Public Fields
In this problem, you will create a program that defines public fields (name, score) in a Student class, directly accesses those fields from Solution.java, and displays the values to standard output.
Learning Objective: Understand how to make fields directly accessible from outside using the public modifier
Overview
Create a Student class with public fields and access them from outside.
Specifications
- Create a Student class (Student.java)
- public String name field
- public int score field
- Create Student object from Solution.java and access fields
Input
Name and score are provided
Output Format
Name: Taro
Score: 85
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up