Home > Back-end >  O master!
O master!

Time:10-05

The problem how to do? The small white don't understand the

CodePudding user response:

The book class:
 public class Book {
Private String bookName;
Private Double bookPrice;
Public Book () {}

Public Book (String bookName, Double bookPrice) {
super();
Enclosing bookName=bookName;
Enclosing bookPrice=bookPrice;
}

Public String getBookName () {
Return bookName;
}
Public void setBookName (String bookName) {
Enclosing bookName=bookName;
}
Public Double getBookPrice () {
Return bookPrice;
}
Public void setBookPrice (Double bookPrice) {
Enclosing bookPrice=bookPrice;
}

@ Override
Public String toString () {
Return "Book [bookName=" + bookName + ", bookPrice="+ bookPrice +"] ".
}
}

The test class:
 public class ZhangSan01 {
Public static void main (String [] args) {
The Book book1=new Book ();
Book1. SetBookName (" data structure ");
Book1. SetBookPrice (48.00);
The Book book2=new Book (" object-oriented programming ", 56.00);
System. The out. Println (" book1: "+" \ nbook2: "+ + book1 book2);
}
}

Hey hey, remember junction post!!!!!!!!!!

CodePudding user response:

1/f, reference source is a ghost reply:
book class:
 public class Book {
Private String bookName;
Private Double bookPrice;
Public Book () {}

Public Book (String bookName, Double bookPrice) {
super();
Enclosing bookName=bookName;
Enclosing bookPrice=bookPrice;
}

Public String getBookName () {
Return bookName;
}
Public void setBookName (String bookName) {
Enclosing bookName=bookName;
}
Public Double getBookPrice () {
Return bookPrice;
}
Public void setBookPrice (Double bookPrice) {
Enclosing bookPrice=bookPrice;
}

@ Override
Public String toString () {
Return "Book [bookName=" + bookName + ", bookPrice="+ bookPrice +"] ".
}
}

The test class:
 public class ZhangSan01 {
Public static void main (String [] args) {
The Book book1=new Book ();
Book1. SetBookName (" data structure ");
Book1. SetBookPrice (48.00);
The Book book2=new Book (" object-oriented programming ", 56.00);
System. The out. Println (" book1: "+" \ nbook2: "+ + book1 book2);
}
}

Hey hey, remember junction post!!!!!!!!!!

Thank you, and how, this app is still not very familiar with

CodePudding user response:

refer to the second floor weixin_45687549 response:
Quote: reference source is ghost reply: 1/f,
book class:
 public class Book {
Private String bookName;
Private Double bookPrice;
Public Book () {}

Public Book (String bookName, Double bookPrice) {
super();
Enclosing bookName=bookName;
Enclosing bookPrice=bookPrice;
}

Public String getBookName () {
Return bookName;
}
Public void setBookName (String bookName) {
Enclosing bookName=bookName;
}
Public Double getBookPrice () {
Return bookPrice;
}
Public void setBookPrice (Double bookPrice) {
Enclosing bookPrice=bookPrice;
}

@ Override
Public String toString () {
Return "Book [bookName=" + bookName + ", bookPrice="+ bookPrice +"] ".
}
}

The test class:
 public class ZhangSan01 {
Public static void main (String [] args) {
The Book book1=new Book ();
Book1. SetBookName (" data structure ");
Book1. SetBookPrice (48.00);
The Book book2=new Book (" object-oriented programming ", 56.00);
System. The out. Println (" book1: "+" \ nbook2: "+ + book1 book2);
}
}

Hey hey, remember junction post!!!!!!!!!!

Thank you, and how, to this app is still not very familiar with

No junction function, mobile version of the web, can find it easily, there are "two words, beside your topic
  • Related