What is 7 % -4? : Questions « Operators « SCJP
Home
SCJP
1.
Java Source And Data Type
2.
Operators
3.
Modifiers
4.
Type Casting
5.
Statements
6.
Object Oriented
7.
Thread
8.
Utility Classes
9.
File
SCJP
»
Operators
»
Questions
2.15.9.What is 7 % -4?
public class
MainClass
{
public static
void
main
(
String
[]
argv
){
System.out.println
(
7
% -
4
)
;
}
}
2.15.Questions
2.15.1.
Is it legal: String x = "Hello"; int y = 9; if (x == y) {}
2.15.2.
Answer: int, string and if statement
2.15.3.
Is it legal: String x = "Hello"; int y = 9; x = x + y;
2.15.4.
Answer: int, string and plus
2.15.5.
Is it legal: String x = "Hello"; int y = 9; y = y + x;
2.15.6.
Answer: string plus int
2.15.7.
What is -8 % 5?
2.15.8.
Answer: negative % positive
2.15.9.
What is 7 % -4?
2.15.10.
Answer: positive % negative
2.15.11.
What does the following code do? (if (i != null && i.intValue() == 5))
2.15.12.
Answer: && and condition statement
2.15.13.
Is it possible to define a class called MyClass as the following?
2.15.14.
Answer: equals method definition
2.15.15.
When a byte is added to a char, what is the type of the result?
2.15.16.
Answer: byte + char
2.15.17.
When a short is added to a float, what is the type of the result?
2.15.18.
Answer: short + float
2.15.19.
What is the result for i ^ i;
2.15.20.
Answer: i ^ i
2.15.21.
Which of the following operations might throw an ArithmeticException(shifting)?
2.15.22.
Answer: shifting and ArithmeticException
2.15.23.
Which of the following operations might throw an ArithmeticException?
2.15.24.
Answer: math operator and ArithmeticException
2.15.25.
What is the return type of the instanceof operator?
2.15.26.
Answer: instanceof operator and return type
www.java2java.com
|
Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.