1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivanshal [37]
3 years ago
7

Analyze the following code: class Test { public static void main(String[] args) { System.out.println(xMethod((double)5)); } publ

ic static int xMethod(int n) { System.out.println("int"); return n; } public static long xMethod(long n) { System.out.println("long"); return n; } }
Computers and Technology
1 answer:
SashulF [63]3 years ago
3 0

Answer:

This code will give Error.

Explanation:

This code will give error because we have passed the argument 5 as double by using typecasting.We have two methods named xMethod but with arguments as int and long none of them has argument as double.The compiler will not be able to find the method with double argument.So this code will not run because of this reason.

You might be interested in
General purpose computer can perform a single task, true or false​
den301095 [7]

Answer:

This is false.

Explanation:

General-purpose computers are desktop computers or laptops that can function in multiple ways. A s<u>pecial-purpose computer</u> is usually designed to do one thing only.

8 0
3 years ago
Create a java program that has a code file with main() in it and another code file with a separate class. You will be creating o
WITCHER [35]

Answer:

public class Registration {

   private String fname;

   private String lname;

   private int noCredits;

   private double additionalFee;

   public Registration(String fname, String lname, int noCredits, double additionalFee) {

       this.fname = fname;

       this.lname = lname;

       this.noCredits = noCredits;

       this.additionalFee = additionalFee;

   }

   public String getFname() {

       return fname;

   }

   public void setFname(String fname) {

       this.fname = fname;

   }

   public String getLname() {

       return lname;

   }

   public void setLname(String lname) {

       this.lname = lname;

   }

   public int getNoCredits() {

       return noCredits;

   }

   public void setNoCredits(int noCredits) {

       this.noCredits = noCredits;

   }

   public double getAdditionalFee() {

       return additionalFee;

   }

   public void setAdditionalFee(double additionalFee) {

       this.additionalFee = additionalFee;

   }

   public void showBill(){

       System.out.println("The bill for "+fname+ " "+lname+ " is "+(70*noCredits+additionalFee));

   }

}

THE CLASS WITH MAIN METHOD

public class RegistrationTest {

   public static void main(String[] args) {

       Registration student1 = new Registration("John","James", 10,

               5);

       Registration student2 = new Registration("Peter","David", 9,

               13);

       System.out.println("Initial bill for the two students: ");

       student1.showBill();

       student2.showBill();

       int newCreditStudent1 = student1.getNoCredits()+3;

       int newCreditStudent2 = student2.getNoCredits()-3;

       student1.setNoCredits(newCreditStudent1);

       student2.setNoCredits(newCreditStudent2);

       System.out.println("Bill for the two students after adjustments of credits:");

       student1.showBill();

       student2.showBill();

   }

}

Explanation:

  1. Two Java classes are created Registration and RegistrationTest
  2. The fields and all methods (getters, setters, constructor) as well as a custom method showBill() as created in the Registration class as required by the question
  3. In the registrationTest, two objects of the class are created and initialized student1 and student2.
  4. The method showBill is called and prints their initial bill.
  5. Then adjustments are carried out on the credit units using getCredit ()and setCredit()
  6. The new Bill is then printed
3 0
3 years ago
When an antivirus program identifies a virus and quarantines this file, has the malware been eradicated
jekas [21]

Answer:

NO

Explanation:

  • No, it's not, when a virus blocks a file stored in a sandbox, it does not affect the system.
  • However, the virus program does not necessarily recognize other parts of the program. It still takes analysis to determine what. Also, the virus vault must be emptied to delete the original files

4 0
3 years ago
What is the scope of leftCharacter?
Lostsunrise [7]

Answer:

Rhymeword

Explanation:

edge 2020

8 0
2 years ago
Read 2 more answers
Which of the following are steps your employer can take to protect you from
lawyer [7]

Answer:

An employer with workers exposed to high temperatures should establish a complete heat illness prevention program. Provide workers with water, rest and shade. Allow new or returning workers to gradually increase workloads and take more frequent breaks as they acclimatize, or build a tolerance for working in the heat.

5 0
3 years ago
Other questions:
  • A self improvement plan should begin with planning how you will accomplish your goal.
    11·2 answers
  • Threads can only be added to cylindrical faces.<br> O True<br> O False
    5·1 answer
  • List and describe the tools for all the main stages of app/application development.
    11·1 answer
  • Which term describes an event where a person who does not have the required clearance or access caveats comes into possession of
    15·2 answers
  • Jerry wants to save his company money. He decides to move to open source software for his word processing needs. Jerry then down
    5·1 answer
  • How do media and networks interact? A. Networks and media work in exactly the same way. B. Media are connected to networks that
    8·1 answer
  • Zahid needs to ensure that the text flows around an image instead of the image being placed on a separate line as the text. Whic
    7·2 answers
  • HELP PLEASE
    14·1 answer
  • Create a class Car, which contains Three data members i.e. carName (of string type), ignition (of bool type), and currentSpeed (
    7·1 answer
  • When receiving your bank account, you should immediately do what
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!