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






Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions





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




close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.