Creating a method in Java
<p>How do a put the contents of case 1 into a method and call it?</p>

<p>See code snippet below:</p>

<pre><code> Teacher jane = new Teacher("jane");
 Teacher alex = new Teacher("alex");

 Set&lt;Teacher&gt; teachers = new HashSet&lt;Teacher&gt;();
 teachers.add(jane);
 teachers.add(alex);

 int selection = scan.nextInt();
 switch (selection) {
     case 1:
         for (Teacher teacher : teachers) {
             System.out.printf("%s ", teacher.getName());
         }
         break;
 }
</code></pre>
