Difference between prefix and postfix forms of the
++operator?

Answers were Sorted based on User's Feedback



Difference between prefix and postfix forms of the ++operator?..

Answer / ranganathkini

The prefix ++ operator first increments the value by one and
then returns the new value.

The postfix ++ operator first returns the value and then
increments it.

Is This Answer Correct ?    36 Yes 1 No

Difference between prefix and postfix forms of the ++operator?..

Answer / ravikiran

prefix will increment first and assigns to the variable
postfix will assing the value to the variable and then
increments

Is This Answer Correct ?    21 Yes 1 No

Difference between prefix and postfix forms of the ++operator?..

Answer / uday ray

They behave differently when they are used in expressions on
the right hand side of an assignment statement. A prefix
operator first adds 1 to the operand and the result is
assigned to the variable on left. On the other hand, a post
fix operator first assign the value to the variable on left
and then increments the operands.

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More Core Java Interview Questions

public class BatchTest { public static void main(String[] args) { Runtime run = Runtime.getRuntime(); try { Process p = run.exec("cmd start /c D:/test.bat"); System.out.println(p.exitValue()); } catch (Exception e) { e.printStackTrace(); } System.out.println("FINISHED"); } }

0 Answers  


Nullpointer exception is a very common exception. Why is it not made as a checked exception?

2 Answers   Ness Technologies,


What is a short in java?

0 Answers  


what is mutual exclusion? : Java thread

0 Answers  


Which java version is latest?

0 Answers  






What are the Static and Dynamic Variables? Differentiate them.

0 Answers   CGI,


Why can't we override private static methods?

0 Answers  


How to change the priority of thread or how to set priority of thread?

0 Answers  


Is special character in java?

0 Answers  


Where is stringbuffer stored?

0 Answers  


please send code example of inner classes?

2 Answers  


Is double bigger than float?

0 Answers  


Categories