Home » Java Aptitude Que. & Ans.

Java Operators Aptitude Questions and Answers



Java Operators Aptitude Questions and Answers: This section provides you Java Operators related Aptitude Questions and Answers with multiple choices. Here, You will get solution and explanation of each question.

List of Java Operators Aptitude Questions and Answers

1) What will be the output of following program ?
class Opr
{
    public static void main(String args[])
    {
        boolean ans=false;
        if(ans=true)
            System.out.print("Done");
        else
            System.out.print("Fail");
    }
}
  1. Done
  2. Fail
  3. Error
  4. DoneFail

2) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int x=5,y;
        y= ++x + x++ + --x;
        System.out.println(x + "," + y);
    }
}

  1. 6,15
  2. 6,18
  3. 6,12
  4. None of these

3) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        byte a,b;
        a=10; b=20;
        b=assign(a);
        System.out.println(a +","+ b);
 
         
    }
    public static byte assign(byte a)
    {
        a+=100;
        return a;
    }
     
}
  1. 110, 110
  2. 10, 110
  3. 10, 10
  4. None of these

4) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int a,b,result;
        a=10; b=20;
        result=(b>=a);
        System.out.print(result);
    }
}

  1. Error
  2. 1
  3. True
  4. 20

5) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int a,b,result;
        a=10; b=20;
        result=(int)(b>=a);
        System.out.print(result);
    }
}

  1. Error
  2. 1
  3. True
  4. 20

Page 2






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.




Comments and Discussions





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com (2015-2018), Some rights reserved.