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 2 of 2

Thread: Where should I toggle the breakpoints ?

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

    Default Where should I toggle the breakpoints ?

    I'd like to understand how this program runs but I dont know where to toggle the breakpoints .

    abstract class A
    {
        abstract void firstMethod();
     
        void secondMethod()
        {
            System.out.println("SECOND");
     
            firstMethod();
        }
    }
     
    abstract class B extends A
    {
        @Override
        void firstMethod()
        {
            System.out.println("FIRST");
     
            thirdMethod();
        }
     
        abstract void thirdMethod();
    }
     
    class C extends B
    {
        @Override
        void thirdMethod()
        {
            System.out.println("THIRD");
        }
    }
     
    public class MainClass1
    {
        public static void main(String[] args)
        {
            C c = new C();
     
            c.firstMethod();
     
            c.secondMethod();
     
            c.thirdMethod();
        }
    }

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

    Default Re: Where should I toggle the breakpoints ?

    Put just one breakpoint on "c.firstMethod();" near the bottom and then use Step Into exclusively. Each statement it stops at is another place where you could put a breakpoint if you wanted.

Similar Threads

  1. toggle colors from an array when the method is called.
    By samjoyboy in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 16th, 2012, 06:00 PM