Last active
May 3, 2018 14:41
-
-
Save yurenju/284cfb127a8ba9de07eb8e007acca317 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
public class MeetupEvent { | |
private String title; | |
private int limit; | |
private ArrayList<String> attendees; | |
public MeetupEvent(String title, int limit) { | |
this.title = title; | |
this.limit = limit; | |
this.attendees = new ArrayList<String>(); | |
} | |
public void register(String member) throws Exception { | |
if (this.attendees.size() < this.limit) { | |
this.attendees.add(member); | |
} else { | |
throw new Exception("ended"); | |
} | |
} | |
public static void main(String[] args) throws Exception { | |
MeetupEvent event = new MeetupEvent("Ethereum Meetup Talk", 40); | |
event.register("Yuren Ju"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment