Question

What is the result of 2^7 in Java? Why does it give this result? What would...

What is the result of 2^7 in Java? Why does it give this result? What would you use to get the result you would have expected before taking this class?

Homework Answers

Answer #1

What is the result of 2^7 in Java?

Answer is : 128.0

Why does it give this result?

Math.pow(2,7) return the double value.

Math.pow(first,second); first argument raised to the power of the second argument.

2*2*2*2*2*2*2 = 128.0 return double, Not integer.

What would you use to get the result you would have expected before taking this class?

System.out.println(2*2*2*2*2*2*2); 2 multiply by itself, 7 times( you get the integer result)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is the result of 2^7 in Java? Why does it give this result?
What is the result of 2^7 in Java? Why does it give this result?
java Give an example of a class that contains at least one class variable and at...
java Give an example of a class that contains at least one class variable and at least one class method. Explain why using a class variable and method rather than an instance variable and method would be the correct choice in the example you select.
Java API Usage: Use the Java API documentation for Standard Edition 7 to answer the following:...
Java API Usage: Use the Java API documentation for Standard Edition 7 to answer the following: a) List the full prototype for the methods that must be coded if a class implements the java.util interface named Iterator. b) How many methods are in the class Track? c) What package is the class Track located in? I am asking for the signature of the method, which is the first line which tells the return data type, the name of the method,...
7. Explain the term Crowding In. What does it refer to, why would it be considered...
7. Explain the term Crowding In. What does it refer to, why would it be considered beneficial, and does this mean there is no crowding out? (7 points)
When does variable costing and absorption costing give similar result ? What makes the result of...
When does variable costing and absorption costing give similar result ? What makes the result of the two methods differ? Give a short explanation
Write a Java program to print the result of the following operations. Your program should contain...
Write a Java program to print the result of the following operations. Your program should contain 4 methods (for each of given data sets). Yes, methods here are not structurally necessary, this requirement is only for you to get practice writing methods. Test Data: a. -8 + 4.0 * 6 b. (11+9) % 9 c. 20 + (-3)*3.0 / 8 d. 5 + 14 / 3 * 2 - 7 % 3 Your program:
Define what a MIC > 32 µg/mL means. What result would be expected? What does the...
Define what a MIC > 32 µg/mL means. What result would be expected? What does the test result tell us about the strain?d
6. What is short circuit evaluation? Give an example. 7. Briefly explain how operator precedence works...
6. What is short circuit evaluation? Give an example. 7. Briefly explain how operator precedence works in APL. 8. What does times do in Ruby? What about each? What about upto? Use code snippets to explain your answers. 9. What is a functional side effect? Give an example in code. 10. What is an unconditional branch statement? If you were to define a new language, would you include this construct? Why or why not?
1a. What 2 parts does every virus need? What is one optional part? 1b. Would a...
1a. What 2 parts does every virus need? What is one optional part? 1b. Would a virus that infects plants have an envelope? Why or why not? *can you please answer the question in your own words, I posted this before and it was all answered by copying&pasting things from the internet that did not fully answer the question -thank you in advance*
What does it mean for the elasticity of demand to be ,7? How would you use...
What does it mean for the elasticity of demand to be ,7? How would you use this elasticity in decision making?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT