1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anarel [89]
3 years ago
9

Create a class BankAccount with 2 variables, a int balance, and a string name. Then create an instance of the BankAccount Class,

change its name and balance, and print its name and balance.
Computers and Technology
1 answer:
almond37 [142]3 years ago
6 0

Answer:

Follows are the code to the given question:

class BankAccount //defining a class BankAccount

{

 int balance;//defining integer variable balance  

 String name;//defining String variable name

 BankAccount()//defining default constructor

 {

 }

  BankAccount(int balance, String name)//defining parameterized constructor that accepts two parameters  

  {

     this.balance = balance;//use this to hold parameter value

     this.name = name;//use this to hold parameter value

  }

}

public class Main//defining Main class

{

 public static void main(String[] asr)//main method  

 {

  BankAccount obv = new BankAccount(1969, "Mustang");//creating class object and pass value in parameter

   System.out.println("Your name is: " + obv.name + " and " +"Your balance is: "+ obv.balance);//print value with message

 }

}

Output:

Your name is: Mustang and Your balance is: 1969

Explanation:

In this code a class "BankAccount" is declared, that  defines the two variable "name and balance" as a integer and string, and in the next step a parameterized constructor is declared, that uses this keyword to hold value.

In the main class the main method is declared and inside the method class object is created that accepts parameter value and use the print method to print its value.

You might be interested in
In Super Mario 64, a character called Lakitu follows Mario around on a cloud, filming him with a camera as though he were shooti
ella [17]

Answer:

A second person prespective

Explanation:

6 0
3 years ago
Read 2 more answers
Where do you place the title tag in HTML​
makkiz [27]

Answer:

The title tag is basically your saved document

Save as and poof

High Hopes^^

Barry-

5 0
2 years ago
What are two ways technology has helped improve in the way we deal with waste?
topjm [15]
It allow us to monitor and study our environment to better understand how it works and the impact of our actions on it and It allows for paperless communication like email and online bill paying to reduce the amount of trees cut down
3 0
3 years ago
Read 2 more answers
The best defense against injection attacks is to
Sergeeva-Olga [200]
The best defense against injection attacks is to develop secure habits and adopt policies and procedures that minimize vulnerabilities. Staying aware of the types of attacks you're vulnerable to because of your programming languages, operating systems and database management systems is critical.
5 0
2 years ago
Chose the two factors that work together to create the global wind patterns that operate in the atmosphere.
WINSTONCH [101]

Yes the ansewer is c bc you can look it up!

5 0
3 years ago
Other questions:
  • A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
    13·2 answers
  • Why is it important to send a cover letter with a resume?
    12·2 answers
  • Which are benefits of modeling a solution? Choose all that apply. allows you to be sure the problem and solution are understood
    9·2 answers
  • Which cost of purchasing a franchise would you still have if you start your own business​
    12·1 answer
  • Which of the following is NOT an argument used to determine how a shot is fired from an A. object the shot itself being instanti
    12·1 answer
  • Chapter 8 discusses five principles for making a graphic clear and understandable. One principle is that the graphic should have
    11·1 answer
  • Características que debe tener un módulo o kit tecnológico para aprender​
    14·1 answer
  • Which file is usually the first file to be displayed when you navigate to a website?
    5·1 answer
  • Henry is creating code In JavaScript to run calculations on extremely small numbers. How can he use MIN_VALUE as validation in t
    6·1 answer
  • What is the difference between DWT and CWT?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!