what is the output???????

public class multireturn
{
public(int assign x ( int x)
{
if(4==x)
{
return 7;
}
else if (7=x+3)
{
return 6;
}
return 5;
}
}

Answers were Sorted based on User's Feedback



what is the output??????? public class multireturn { public(int assign x ( int x) { if..

Answer / pranali bhise

It will result in Compile time error due to 3 reasons
1) The parenthesis '(' after public is not allowed.
2) The space between "assign" and "x" is not allowed
3) 7 = x + 3 is not allowed as a variable is needed on the
left hand side of the assignment operator.

Is This Answer Correct ?    15 Yes 0 No

what is the output??????? public class multireturn { public(int assign x ( int x) { if..

Answer / amit singh

answer is that compile time error
because what you did i don't know what i saw i know
else if(7=x+3)
it not a condition you are using the assignment operator
in place of (7==x+3)
amitsing2008@gmail.com

Is This Answer Correct ?    7 Yes 0 No

what is the output??????? public class multireturn { public(int assign x ( int x) { if..

Answer / guest

7 or 5 depending on value of x but never 6

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the use of arrays tostring () in java?

0 Answers  


Why scanner is used in java?

0 Answers  


What is meant by class loader and how many types are there?

2 Answers   Apple,


what are depricated methods in threads and explain the lifecycle methods

5 Answers   CTS,


What is connection class in java?

0 Answers  






What is protected in java?

0 Answers  


This is my code i have a doubt class ab implements a,b { public void add() { System.out.println("Hi") } } interface a { public void add(); } interface b { public void add(); } in this code i have two interface implemented in the class has same method.just i want to know which method of interface implemented in the class. interface a or interface b? confused me .

3 Answers  


What sorting algorithm does javascript use?

0 Answers  


What are the main uses of the super keyword?

0 Answers  


How are java objects passed to a method and what are native methods?

0 Answers   Genpact,


What is return type in java?

0 Answers  


Can you use abstract and final both with a method?

0 Answers  


Categories