01. code is as follows:
Package Penalty for TIANPAN; class Book { private String title; private double price; public Book(String title, double price) { this.title = title; this.price = price; } public String getTitle() { return this.title; } public double getPrice() { return this.price; } } /** * Documentation comment here * * @author 田攀 微信382477247 */ public class TestDemo { public static void main(String args[]) { B1 Book = new new Book ( "the Java Development", 79.8); // instantiate an object class Book Book B2 = new new Book ( "the Java Development", 79.8); // instantiate class object Book IF (b1.getTitle (). the equals (b2.getTitle ()) && b1.getPrice () == b2.getPrice ()) { // attribute comparison System.out.println ( "same object!" ); } else { System.out.println ( "not the same object!" ); } } }
02. Results are as follows:
Knowledge has a price, if you think this article valuable, authors agree to pay, micro-channel two-dimensional code can be any amount of a reward to the author (Micro Signal: 382 477 247) Oh, thank you.