Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions 77 Chapter8/Interface/Implementing_Interfaces.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package Interface;

import Cpp.this_keyword;

//An interface specifies what must be done, but not how to get it done.
interface Series4{

Expand Down Expand Up @@ -133,6 +131,81 @@ public class Implementing_Interfaces {

public static void main(String[] args) {
// TODO Auto-generated method stub

ByTwos2_ oByTwos2_ = new ByTwos2_();

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByTwos2_.getNext());
}

System.out.println("\nResetting");

oByTwos2_.reset();

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByTwos2_.getNext());
}

System.out.println("\nStarting at 100");

oByTwos2_.setStart(100);

for (int i = 0; i < 5; i++) {

System.out.println("Next value is " + oByTwos2_.getNext());
}

System.out.println();

ByTwos4 oByTwos4 = new ByTwos4(9);

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByTwos4.getNext());
}

System.out.println("\nResetting");

oByTwos4.reset();

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByTwos4.getNext());
}

System.out.println("\nStarting at 100");

oByTwos4.setStart(100);

for (int i = 0; i < 5; i++) {

System.out.println("Next value is " + oByTwos4.getNext());
}

System.out.println();

ByThrees2 oByThrees2 = new ByThrees2();

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByThrees2.getNext());
}

System.out.println("\nResetting");

oByThrees2.reset();

for (int i = 0; i < 5; i++) {
System.out.println("Next value is " + oByThrees2.getNext());
}

System.out.println("\nStarting at 100");

oByThrees2.setStart(100);

for (int i = 0; i < 5; i++) {

System.out.println("Next value is " + oByThrees2.getNext());
}

System.out.println();

}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.