Java Operators Questions and Answers
1. Which of the following can be operands of arithmetic operators?
Loading...
2. What is the output of the program.
class operators {
public static void main(String args[])
{
int x = 8;
System.out.println(++x * 3 + "," + x);
}
}
Loading...
3. What is the output of the program.
public class Test
{
public static void leftshift(int i, int j)
{
i <<= j;
}
public static void main(String args[])
{
int i = 4, j = 2;
leftshift(i, j);
System.out.printIn(i);
}
}
Loading...
4. what is the output of the program ?
class Equals
{
public static void main(String [] args)
{
int x = 100;
double y = 100.1;
boolean b = (x = y);
System.out.println(b);
}
}
Loading...
5. What is the output of the program ?
class Test
{
public static void main(String [] args)
{
int x=20;
String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge";
System.out.println(sup);
}
}
Loading...
6. Modulus operator, %, can be applied to which of these?
Loading...
7. Decrement operator, –, decreases value of variable by what number?
Loading...
8. Which of these statements are incorrect?
Loading...
9. What is the output of this program?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
Loading...
10. Which of these is not a bit-wise operator?
Loading...
Are these questions helpful for you?
Related Quizzes
- Introduction To Java
- Java Network Programming
- Java File Input Output
- Java Socket Programming
- Java Data Types
- Java Operators
- Java Strings
- Java Arrays
- Java Package And Interface
- java.lang Package
- Java Swings
- Java Applets
- Java Exception Handling
- JSP And Servlet
- Struts And Hibernate
- Java Session
- JDBC
- Java Classes And Methods
- Java Generics
- Java Multithreading
Comments: (Your feedback is valuable to us)
Tarekegn Kelta 1 year ago Reply
I wish if you add more explanations. thanks