- b
- c
- abc
- a
- a
- a
- c
- a
- d
- abc
public class Book {
private String title;
private String author;
private String publisher;
private double price;
public Book() {
this.title = "1";
this.author = "1";
this.publisher = "出版社";
this.price = 15;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
if(price > 10) {
this.price = price;
} else {
System.out.println("价格必须大于10!");
this.price = 10;
}
}
public static void main(String[] args) {
Book book = new Book();
System.out.println(book.title);
System.out.println(book.author);
System.out.println(book.publisher);
System.out.println(book.price);
}
}
public class User {
private String userName;
private String password;
public User() {
this.userName = "Luck";
this.password = "123456";
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public static void main(String[] args) {
User us = new User();
System.out.println("用户名:" + form.userName);
System.out.println("密码:" + form.password);
form.setUserName("Mike");
form.setPassword("123456");
System.out.println("用户名:" + form.userName);
System.out.println("密码:" + form.password);
System.out.println("===============");
if(form.userName.equals("Luck") && form.password.equals("123456")) {
System.out.println("用户名和密码一致");
} else {
System.out.println("用户名和密码不一致");
}
}
}