课程: Hands-On Introduction: Java

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Create account

Create account

- In our database, we have an accounts table that holds multiple records of accounts. The columns are ID, type, and balance. In this video, we'll create a Java class to model this object. The steps to complete this task are similar to the ones from the last video, where we created a customer class. So if you'd like, you can pause the video here, and work on the solution independently. (jazz music) Okay. First, we need to create an account class. So we'll go to our bank package, and we'll click the plus sign, and create a new class called "Account." We need to declare the three fields, so we'll say, "private int id, private string type, and private double balance." And let's generate the getter and setter methods for these fields as well. So we'll right click, we'll go to Java Code Generators, and we'll choose generate getters and setters. Finally, we want to create a constructor, so that when someone needs…

内容