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
strojnjashka [21]
3 years ago
12

You have been handed a mysterious piece of data by an unknown person. Judging by his shifty eyes and maniacal laughter you don't

think he can be trusted. Complete the below method to tell you the type for this unknown data. The example already implemented can be adapted for other wrapper classes as well. Complete the method to analyze String, Character, and Double. Examples: whatAmI(1) -> "Integer" 1 public String whatAmI(E e) { 3 //.getClass() returns the runtime class of an object //.equals() determines whether two objects are equivalent //by calling a new static instance of a wrapper object we can analyze //it's class type and compare it to the variable passed in if(e.getClass().equals(new Integer(1).getClass()) { return "Integer"; }else{ return "Who knows!"; Given a word, use a stack to reverse the word and return a new string with the original word in reverse order. You cannot use the reverse string methods in the String class. Examples: reverseword("hello") -> "olleh" reverseword("hallo") -> "ollah" i public String reverseWord(String word) Stack character> stack = new Stack ;
Computers and Technology
1 answer:
irga5000 [103]3 years ago
5 0

Answer:

Java Code given below with appropriate comments for better understanding

Explanation:

1.

public String whatAmI(E e) {

//.getClass() returns the runtime class of an object

//.equals() determines whether two objects are equivalent

//by calling a new static instance of a wrapper object we can analyze

//it's class type and compare it to the variable passed in

if(e.getClass().equals(new Integer(1).getClass())) {

return "Integer";

}

else if(e.getClass().equals(new String("1").getClass())) {

return "String";

}

else if(e.getClass().equals(new Double(1.0).getClass())) {

return "Double";

}

else {

return "Who knows!";

}

}

2.

public String reverseWord(String word) {

   Stack<Character> stack = new Stack<Character>();

   for (int i = 0; i < word.length(); i++) {

       stack.push(word.charAt(i));

   }

   String result = "";

   while (!stack.isEmpty()) {

       result += stack.pop();

   }

   return result;

}

You might be interested in
Write the importance of program in computer​
zysi [14]

Answer:

The reason that programming is so important is that it directs a computer to complete these commands over and over again, so people do not have to do the task repeatedly. Instead, the software can do it automatically and accurately.

Explanation:

5 0
2 years ago
Once the CPU has fetched the data requested, what are the next steps in the process?
Bezzdna [24]

Answer:

D. decode execute

Explanation:

3 0
2 years ago
Write steps to Delete data from ‘Datagridview’
julsineya [31]

Explanation:

private void btnDelete_Click(object sender, EventArgs e)

{

if (this.dataGridView1.SelectedRows.Count > 0)

{

dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index);

}

}

8 0
3 years ago
A_________is a way for students to keep track of information during research.
Fudgin [204]
Note pad your welcome


4 0
3 years ago
Where should a user disable virus protection settings that might prevent the boot area of the hard drive from being altered?
leonid [27]

Answer:BIOS setup

Explanation:

BIOS setup is a program used alter or changes the settings of a computer hardware system,it is in the BIOS setup that the user of a company system can disable the Virus and other forms of protection which prevents the system from performing efficiently. To gain access to the BIOS setup one has to turn off the system and wait for up to 5seconds before turning on,press the Esc key constantly for some time until the Start up menu opens then press the F10 to gain access to the BIOS setup.

3 0
3 years ago
Other questions:
  • Please look at picture
    10·2 answers
  • In doing a load of clothes, a clothes drier uses 18 A of current at 240 V for 59 min. A personal computer, in contrast, uses 3.0
    7·1 answer
  • What options of the hierarchical star topology within the ANSI/TIA-568-C allow the ability to move the workgroup switches closer
    7·1 answer
  • Frank lives in an area that experiences frequent thunderstorms. What precautionary measure should he adopt?
    5·1 answer
  • What are the text or graphics that are lighter than the main text located in a document's background called?
    10·1 answer
  • What is first page of website called​
    10·1 answer
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • What are some innovations that television has undergone since its original invention ?
    11·1 answer
  • When using MakeCode Arcade, what is the easiest way to make modules?
    6·1 answer
  • How do you modify WordArt? Give specific details and steps<br><br> NEED THIS ASAP
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!