.

This chapter from Java SE8 for Programmers shows how to create your own Java classes and methods, presenting a case study on creating and using a simple, real-world bank account class — . This chapter also introduces data type to represent an account balance as a number that can contain a decimal point—such numbers are called floating-point numbers.

This chapter is from the book 

3.1 Introduction

[Note: This chapter depends on the terminology and concepts discussed in Section 1.2, Object Technology Concepts.]

In Chapter 2, you worked with existing classes, objects and methods. You used the predefined standard output object , invoking its methods , and to display information on the screen. You used the existing class to create an object that reads into memory integer data typed by the user at the keyboard. Throughout the book, you’ll use many more preexisting classes and objects.

In this chapter, you’ll create your own classes and methods. Each new class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed; this is one reason why Java is known as an extensible language.

We present a case study on creating and using a simple, real-world bank account class—. Such a class should maintain as instance variables attributes such as its and , and provide methods for tasks such as querying the balance (), making deposits that increase the balance () and making withdrawals that decrease the balance (). We’ll build the and methods into the class in the chapter’s examples.

In Chapter 2 we used the data type to represent integers. In this chapter, we introduce data type to represent an account balance as a number that can contain a decimal point—such numbers are called floating-point numbers. [In Chapter 8, when we get a bit deeper into object technology, we’ll begin representing monetary amounts precisely with class (package ) as you should do when writing industrial-strength monetary applications.]

0 Replies to “Bank Account Java Assignment Operators”

Leave a comment

L'indirizzo email non verrĂ  pubblicato. I campi obbligatori sono contrassegnati *