- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between x++ and x= x+1 in Java programming
x++ automatically handles the type casting where as x= x + 1 needs typecasting in case of x is not an int variable. See the example below.
Example
public class Tester { public static void main(String args[]) { byte b = 2; //Type casting is required //as 1 is int and b is byte variable b = (byte) (b + 1); System.out.println(b); byte b1 = 2; //Implcit type casting by the compiler b1++; System.out.println(b1); } }
Output
3 3
- Related Articles
- Difference between x++ and x = x+1 in Java
- Difference between NumberLong(x) and NumberLong(“x”) in MongoDB?
- If ( x+frac{1}{x}=3 ), calculate ( x^{2}+frac{1}{x^{2}}, x^{3}+frac{1}{x^{3}} ) and ( x^{4}+frac{1}{x^{4}} ).
- If ( x^{4}+frac{1}{x^{4}}=194 ), find ( x^{3}+frac{1}{x^{3}}, x^{2}+frac{1}{x^{2}} ) and ( x+frac{1}{x} )
- Check whether the following are quadratic equations:(i) ( (x+1)^{2}=2(x-3) )(ii) ( x^{2}-2 x=(-2)(3-x) )(iii) ( (x-2)(x+1)=(x-1)(x+3) )(iv) ( (x-3)(2 x+1)=x(x+5) )(v) ( (2 x-1)(x-3)=(x+5)(x-1) )(vi) ( x^{2}+3 x+1=(x-2)^{2} )(vii) ( (x+2)^{3}=2 xleft(x^{2}-1right) )(viii) ( x^{3}-4 x^{2}-x+1=(x-2)^{3} )
- If the points $(x+1, 2), (1, x+2)$ and $( frac{1}{x+1}, frac{2}{x+1})$ are collinear, then find $x$.
- Solve for $x$:( 1-(x-2)-[(x-3)-(x-1)]=0 )
- If ( x+frac{1}{x}=sqrt{5} ), find the values of ( x^{2}+ frac{1}{x^{2}} ) and ( x^{4}+frac{1}{x^{4}} ).
- Absolute difference between the first X and last X Digits of N?
- Verify whether the following are zeroes of the polynomial, indicated against them.(i) ( p(x)=3 x+1, x=-frac{1}{3} )(ii) ( p(x)=5 x-pi, x=frac{4}{5} )(iii) ( p(x)=x^{2}-1, x=1,-1 )(iv) ( p(x)=(x+1)(x-2), x=-1,2 )(v) ( p(x)=x^{2}, x=0 )(vi) ( p(x)=l x+m, x=-frac{m}{l} )(vii) ( p(x)=3 x^{2}-1, x=-frac{1}{sqrt{3}}, frac{2}{sqrt{3}} )(viii) ( p(x)=2 x+1, x=frac{1}{2} )
- If ( x^{2}+frac{1}{x^{2}}=62, ) find the value of( x+frac{1}{x} )( x-frac{1}{x} )
- Simplify the following:$frac{x^{-1}+y^{-1}}{x^{-1}}+frac{x^{-1}-y^{-1}}{x^{-1}}$
- Solve for $x$:$frac{16}{x}-1=frac{15}{x+1}, x≠0, -1$
- For $x=frac{3}{4} $and $y=frac{-9}{8}$, insert a rational number between:$(x+y)^{-1} and x^{-1}+y^{-1} $
- Difference between %p and %x in C/C++

Advertisements