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
hammer [34]
3 years ago
10

Public class SomeClass { private String aName; private int aNumber; private boolean amAwesome; public SomeClass(String name, int

number){ aName = name; aNumber = number; amAwesome = true; } public SomeClass(String name, int number, boolean awesome){ aName = name; aNumber = number; amAwesome = awesome; } public void methodAwesome(int number){ if(amAwesome) aNumber += number - 5; amAwesome = !amAwesome; } public int method Fantastic(boolean fantastic){ fantastic = fantastic && amAwesome; if(!fantastic && aNumber > 0) aName = aName + " is fantastic"; return aNumber *= -2; } public void methodAmazing(int num){ if(aNumber < 0) aNumber = num; } public static void main(String[] args) { SomeClass awesome = new SomeClass("Awesome", 5); awesome.methodAmazing(10); int eNum = awesome.method Fantastic(true); SomeClass amazing = new SomeClass("Amazing", -10, false); amazing.methodAwesome(7); amazing.methodAmazing(18); SomeClass fantastic = new SomeClass ("Fantastic", 11, true); int fanNum = fantastic.methodFantastic(true); fantastic.methodAwesome(awNum + fanNum); } }
How many objects are created in the main method
Computers and Technology
1 answer:
scoray [572]3 years ago
3 0

Answer:

The objects created in the main method and their initial states are given below

Explanation:

The objects and initial state of each object( the values of each object’s variables) are thus:

We have objects awesome, amazing and fantastic.

initial state of awesome object is

aName = "Awesome"; aNumber = 5; amAwesome = true;

initial state of amazing object is

aName = "Amazing"; aNumber = -10; amAwesome = false;

initial state of fantastic object is

aName = "Fantastic"; aNumber = 11; amAwesome = true

You might be interested in
Write a Java program to accept an item's name and price from the user and output them to the console
Anit [1.1K]

Answer:

// program in java.

// package

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read inputs

Scanner scr=new Scanner(System.in);

 // variables

String name;

   double price;

   System.out.print("Enter item's name: ");

   // read item's name

   name = scr.next();

   System.out.print("Enter item's price: ");

   // read item's price

   price= scr.nextDouble();

   // print name

   System.out.println("name of item is:"+name);

   // print price

   System.out.println("price of item is:"+price);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read name & price of item from user and assign it to variables "name" & "price" respectively with scanner object.Then print the name and price of item .

Output:

Enter item's name: Apple                                                                                                  

Enter item's price: 100                                                                                                    

name of item is:Apple                                                                                                      

price of item is:100.0

6 0
2 years ago
A company that manufactures smartphones makes 70% of the phones with a touch screen and 55% of the phones with HD movie capabili
Maru [420]
Using Rule of Addition:
<span>It states that : "The probability that Event A or Event B occurs is equal to the probability that Event A occurs plus the probability that Event B occurs minus the probability that both Events A and B occur."
</span><span>
P(A or B) = P(A) + P(B) - P(A and B)
</span>                 = 0.7 + 0.55 - 0.3
                 = 1.55
5 0
3 years ago
Read 2 more answers
What is the maximum length of a text field can be?<br>​
Luda [366]

Answer:

4000 characters

Explanation:

I think the max is 4000 characters

7 0
1 year ago
Read 2 more answers
As the European powers grew more industrialized, their colonies became very important as sources of A)slave labor. B)raw materia
nadezda [96]
B) Raw materials; As stated, European powers did indeed grow more industrialized, therefore they needed more raw materials. The North provided lumber, spent time whaling, etc.. The South spent time growing cash crops such as rice, cotton, and indigo. 
8 0
3 years ago
Read 2 more answers
Write an if statement that tests to see whether a String stored in a variable named phrase begins with a capital letter. If the
mamaluj [8]

Answer & Explanation:

//written in java

public class Main {

   public static void main(String[] args) {

       //String stored in a variable named phrase

       String phrase = "Brainly";

       //Checking whether the first character is in upper case or not

       if (Character.isUpperCase(phrase.charAt(0)))

           System.out.println("capital");

       else

           System.out.println("not capital");

   }

}

4 0
3 years ago
Other questions:
  • Using Gen/Spec, classes can be organized by using a peer-to-peer inheritanc True/false
    10·1 answer
  • This tag element is the last one used in the html code sequence
    7·1 answer
  • If x is an int, which of the following statements adds 5 to the current value of x and stores the new value back in x?
    12·1 answer
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    7·2 answers
  • You need to secure your wireless network. which security protocol would be the best choice
    10·1 answer
  • When activated, an Excel object has all the features of an Excel ______?
    9·2 answers
  • Does any body know how to bypass easy anti cheat on crossout
    7·1 answer
  • Which components exist in the contextual tab for tables called Design? Check all that apply.
    15·2 answers
  • The average number of entities completed per unit time -- the output rate -- from a process is called ____.
    9·1 answer
  • Laura is filming a scene in which the subject is sitting with a lit fireplace behind him. The only other source of light in the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!