Show the output of the following code:
java.util.Date date = new java.util.Date();
java.util.Date date1 = date;
java.util.Date date2 = (java.util.Date) (date.clone());
System.out.println(date == date1);
System.out.println(date == date2);
System.out.println(date.equals(date2));
Want to see the full answer?
Check out a sample textbook solutionChapter 13 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version, Student Value Edition (11th Edition)
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Starting Out with Python (4th Edition)
Electric Circuits. (11th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Web Development and Design Foundations with HTML5 (8th Edition)
- import java.util.Scanner; public class Application {public static void main(String[] args){ int Num;float Ave;Employee[] Emp = new Employee[100]; System.out.println("Enter the number of employees:");Num = Integer.parseInt(new Scanner(System.in).nextLine());for (int i = 0; i < Num; i++){ Emp[i] = new Employee();Emp[i].Input();} System.out.printf("The list of employees:");System.out.println();Display(Emp, Num);Ave= AverageSalary(Emp, Num);System.out.printf("\nAverage salary is:" + "%.2f", Ave); System.out.printf("\nThe employee with highest salary is:\n" + employeeHigh(Emp, Num));}private static float AverageSalary(Employee [] emps, int n){float sum=0; for (int i = 0; i < n; i++)sum = sum + emps[i].salary;return sum/n;}private static void Display(Employee[] arr, int n){ for (int i = 0; i < n; i++){System.out.printf("%s",arr[i]);}}private static Employee employeeHigh(Employee[] arr, int n){ float high= arr[0].salary ;int iHigh = 0;for (int i = 1; i < n; i++){if( arr[i].salary…arrow_forwardI have problem in java 2 code: lease.setApartmentNumber(sc.nextLine()); melt:String cannot be converted to int and lease.setMonthlyRent(sc.nextLine()); melt introduce variable and lease.setPeriod(sc.nextLine()); melt: introduce variable System.out.println("Tenant's Name"+lease.getTenantName()+"\nApartment Number:"+lease.getApartmentNumber()+"\nMonthly Rent:"+NumberFormat.getCurrencyInstance().format(lease.getMonthlyRent())+"\nTerm of lease in month;"+lease.getPeriod());} melt: create Object getMonthlyRent() Java 1: package lease; public class Lease { private String tenantName;private int apartmentNumber;private double monthlyRent;private int Period; public Lease() {apartmentNumber = 0;int monthlyRent = 10000;int Period = 12; } // Getter Methodpublic String getTenantName() {return tenantName;} public void setTenantName(String tenantName) { this.tenantName = tenantName;} public int getApartmentNumber() {return apartmentNumber;} public void setApartmentNumber(int…arrow_forwardRun the programme and identify the outputs: void Test (int z[]) #include using namespace std; void Test (int []); int main () { int myArr [4]={3,4,5,6}; { int temp=z[3] ; z[3]=z[0]; z [0]=temp; for (int i=0;i<4;i++) cout<arrow_forwardJava question: Please use words to describe exactly how the computer process doSomething(3) public void doSomething(int n){ if (n > 0){ doSomething(n - 1); System.out.print(n); doSomething(n - 1); } }arrow_forwardYou are required to implement a preprocessor in Java. Your preprocessor should be able to perform the following tasks on an input file, which will be a Java source file: 1. Removing comments 2. Identifying built-in language constructs 3. Identifying loops and methodsarrow_forwardJava Language Please help me fix all the error. I very appreciate it Coding: import java.util.Scanner;public class Main { /*static displayline(); char line; { for (int i = 1; i < line; i++ ) { System.out.println ("_"); } } */ public static void main(String[] args) { System.out.println("Clinic Management\n"); int PatAge, Pnumber,age; int cmedicine, cost, Pcost, total, newTotal; String PatName, Pgender, Pdisease, Pmedicine; char typeofmedicine; Scanner scan = new Scanner(System.in); System.out.println("Patient Name :"); String name = scan.next(); name = name + scan.nextLine(); System.out.println("Patient Age :"); age = scan.nextInt(); System.out.println("Patient Gender :"); String gender = scan.next(); System.out.println("Patient Phone Number :"); Pnumber = scan.nextInt(); System.out.println("Patient Disease :" ); String disease =…arrow_forwardDo complete all tbe code..arrow_forwardTranslate the following Java code into VM code. int positiveDivide(int a, int b){ int quotient = 0; int divisor = b; while (divisor <= a) { quotient++; divisor += b; } return quotient;}arrow_forwardExpand the wedding class to include six weddings. import java.time.*;public class TestWedding{public static void main(String[] args){LocalDate date1 = LocalDate.of(1986, 12, 14);LocalDate date2 = LocalDate.of(1984, 3, 8);LocalDate date3 = LocalDate.of(1991, 4, 17);LocalDate date4 = LocalDate.of(1992, 2, 14);LocalDate date5 = LocalDate.of(2016, 6, 18);LocalDate date6 = LocalDate.of(2016, 6, 25); Person bride1 = new Person("Kimberly", "Hanson", date1); // Create New personPerson groom1 = new Person("Mark", "Ziller", date2); // Create New personPerson bride2 = new Person("Janna", "Howard", date3); // Create New personPerson groom2 = new Person("Julius", "Nemo", date4); // Create New personCouple couple1 = new Couple(bride1, groom1); // Create New coupleCouple couple2 = new Couple(bride2, groom2); // Create New coupleWedding wedding1 = new Wedding(couple1, date5, "Mayfair Country Club");// create a wedding and send it couple1, date5 and a placeWedding wedding2 = new Wedding(couple2,…arrow_forwardWritten in java, Your Tasks: Driver class CarInLine: import java.io.*;class CarInLine{static int ctr=0;static int cars,cash;static int DepartureTime=0;static int arrivalTime=0;static int ctr_tax=0; CarInLine(){ctr++;cars=0;cash=0;}void pcar(){System.out.print(“\nEnter the amount of toll:”);cash=cash+cash;cars++;}void npcar(){cars++;}void disp(){System.out.print(” \n\Number of cashiers\n\n”);System.out.print(“\tAverage time\n\n”);System.out.print(“\Optimum number of cashiers is");}}void tax(int a){if(a==1)ctr_tax++;}}class booth{public static void main(String arg[]){DataInputStream ins=new DataInputStream(System.in);int ans=1,ncar=5;do{CarInLine c=new car();try{System.out.print("Press 1 if u want to pay tax ");ans=Integer.parseInt(ins.readLine());c.tax(ans);System.out.print("Another car? Press 5 ");ncar=Integer.parseInt(ins.readLine());}catch(IOException e){ }} while(ncar==5);System.out.println("Average Procesing time: "+car.ctr);int non = car.ctr -…arrow_forwardPlease fix errors for the java code below. The program is a t square fractal (image below) import javax.swing.*;import java.awt.*;import java.awt.geom.*; //main classpublic class SquareFractal { public static void main(String[] args) { FractalFrame tframe = new FractalFrame(); tframe.setTitle("T Square Fractal"); tframe.setVisible(true); }} //JFrame extended in fractal class class T_Fractal extends JFrame{ private JPanel panel; private int twidth, theight; private int x = 200; private int limit = 15; public T_Fractal() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //default height and width final int Width = 1000; final int Height = 1000; setSize(Width, Height); setLocation(200,50); panel = new JPanel(); Container t_content = getContentPane(); t_content.add(panel, "Center"); } public void paint(Graphics graphics) { super.paint(graphics); Graphics2D g2 = (Graphics2D) graphics; twidth = getWidth(); theight = getHeight();…arrow_forwardimport java.util.Scanner; public class ShadyRestRoom2{ public static void main(String[] args) { int selection; int price; String result; final int QUEEN = 1, KING = 2, SUITE = 3; final int QPRICE = 125, KPRICE = 139,SPRICE = 165; final String QSTRING = "Queen bed", KSTRING = "King bed", SSTRING = "Suite with a king bed and pull-out couch", INVALIDSTRING = "an invalid option"; Scanner in = new Scanner(System.in); System.out.println("\t\n\nMenu\n"); System.out.println("(" + QUEEN + ") " + QSTRING); System.out.println("(" + KING + ") " + KSTRING); System.out.println("(" + SUITE + ") " + SSTRING); System.out.print("Enter Selection (1, 2, or 3) >> "); selection = in.nextInt(); if(selection == QUEEN){ result = QSTRING; price = QPRICE; } else if(selection == KING){ result = KSTRING; price = KPRICE; } else if (selection == SUITE){ result = SSTRING; price =…arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education