Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Abstract and code output

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Abstract and code output

    Please explain me the output

    Output is : 0



    class ClassOne
    {
        int methodOne(int i, int j)
        {
            return i++ + ++j - ++i - j++;
        }
    }
     
    abstract class ClassTwo extends ClassOne
    {
        abstract int methodOne(int i, int j, int k);
     
        @Override
        int methodOne(int i, int j)
        {
            return methodOne(i, j, i+j);
        }
    }
     
    class ClassThree extends ClassTwo
    {
        @Override
        int methodOne(int i, int j, int k)
        {
            return --i - j-- + ++k - i++ + ++j - k--;
        }
    }
     
    public class MainClass
    {
        public static void main(String[] args)
        {
            ClassOne one = new ClassOne();
     
            ClassThree three = new ClassThree();
     
            System.out.println(three.methodOne(one.methodOne(10101, 20202), one.methodOne(20202, 10101)));
        }
    }

  2. #2
    Member
    Join Date
    Apr 2014
    Posts
    93
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default Re: Abstract and code output

    To explain the output, you need to first understand how the increment operators work. Are you having trouble understanding the difference between j++ and ++j, for instance?

  3. #3
    Junior Member
    Join Date
    Jan 2020
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Abstract and code output

    Hi, I am thinking about making an app, But I want to know the how to check its abstract and code output. Hopefully I found https://www.andromo.com/ where I can learn making an app with out leraing any coding and Its totally free. If you also want to learn making app with coding you can also visit here.
    Last edited by EarlEGrant; August 2nd, 2021 at 05:40 AM.

Similar Threads

  1. Can't get right output for my code
    By tinypants in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 10th, 2014, 01:55 PM
  2. how to get output for this ajax using code. Code is shown bellow.
    By pragathi in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 4th, 2014, 05:51 AM
  3. Java Abstract class and Interface issues in a code
    By John234 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 5th, 2013, 09:51 PM
  4. [SOLVED] Abstract method in a non-abstract class
    By bassie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 2nd, 2012, 11:27 AM
  5. GUI error: is not abstract and does not override abstract method
    By djl1990 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 21st, 2011, 01:26 PM