Intro To Java Workshop
Section 3: Strings and Dialogs

Hello World - syso

If any student did not get the workshop code, they should do that now.

All students should clone and import their Java Project into Eclipse.

  • Talk the students through making a new class called HelloWorld in the section3 package.
  • Explain how to use Eclipe's ctrl-space to short-cut writing code.
  • Demonstrate the short-cut to create a main method.
  • Explain "syso" .
  • Demonstrate using double quotes to delimit strings. Have students print "Hello World" to console
  • Run the program

Output Dialog

  • Introduce JOptionPane and the message dialog.
  • Write format of how to use showMessageDialog() on whiteboard.
  • Have students create a NicestProgram class and give 3-4 compliments using message dialogs.

Input Dialog

  • Introduce the input dialog.
  • Introduce the String variable.
  • Write format of how to use showInputDialog() on whiteboard.
  • Have students create a Greeter class to ask the user their name and put it in a variable.
  • Explain how to join the name to a greeting and have students display the whole message in an output dialog.

Dialog Recipes

All these recipes are contained in the section3 package of the workshop project.

If you have time, you can do all of these. If not, use your audience to gauge which will have the most appeal.

  • CandyCrush
  • Madlibs
  • Stephen Hawking (may not work on all operating systems)

if statement

Before they code these recipes, they will need to know how to code an if statement

  • World Domination
  • Speak and Spell (may not work on all operating systems)