Tuesday 27 October 2015

Java Tutorial : Java Prefix and Postfix Operators


Click here to watch in Youtube : 
https://www.youtube.com/watch?v=h8d6uV15bYU&list=UUhwKlOVR041tngjerWxVccw

PrePostDemo1.java
class PrePostDemo1
{
    public static void main(String[] args)
    {
        int i = 5;
        i++;
        // prints 6
        System.out.println(i);
        ++i;
        // prints 7
        System.out.println(i);
        
    }
}
Output
6
7
PrePostDemo2.java
class PrePostDemo2
{
    public static void main(String[] args)
    {
        int i = 5;

        int j = ++i;

        System.out.println("j : " + j);

        System.out.println("i : " + i);

    }
}
Output
j : 6
i : 6
PrePostDemo3.java
class PrePostDemo3
{
    public static void main(String[] args)
    {
        int i = 5;

        int j = i++;

        System.out.println("j : " + j);

        System.out.println("i : " + i);

    }
}
Output
j : 5
i : 6
To Download OperatorsDemoPrePostFixApp Project Click the below link
https://sites.google.com/site/javaee4321/java/OperatorsDemoPrePostFixApp.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment