009-002-003

Public Modifier: Access Control Demo

Easy

Problem Description

Public Modifier: Access Control Demo

In this problem, you will create a program that defines a BankAccount class with public fields and methods, accesses them directly from an external class, and displays the account information to standard output.

Learning Objective: Understand external access through public modifier

Create a BankAccount class and use public modifier to make fields and methods accessible from outside.

Input

Line 1: Account name (string)
Line 2: Initial balance (integer)

Output

Account: [account name]
Balance: [balance] yen

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