Fear Not Demon Curses
From Huben's Wiki
Line 1: | Line 1: | ||
If we make even the tiniest mistake during our incantations, our demons will hurl dire curses at us, called '''error messages'''. | If we make even the tiniest mistake during our incantations, our demons will hurl dire curses at us, called '''error messages'''. | ||
+ | ==(A) First Incantations== | ||
Consider this simplest of demons: | Consider this simplest of demons: | ||
<pre> | <pre> | ||
Line 23: | Line 24: | ||
This demon invocation contains two major incantations. An incantation is magical lore that you need not understand, yet when repeated will still command our demons. The first incantation, '''static public void main(String[] args)''', is how we create a class of demons called '''console applications'''. The second incantation, '''System.out.println("Hello world!");''' is a statement that commands demons to print something to the console. The console is the bottom pane of Dr. Java, or in the Windows '''Command Prompt''' application. The muggle textbook tells how to do the latter in chapter 2.4. | This demon invocation contains two major incantations. An incantation is magical lore that you need not understand, yet when repeated will still command our demons. The first incantation, '''static public void main(String[] args)''', is how we create a class of demons called '''console applications'''. The second incantation, '''System.out.println("Hello world!");''' is a statement that commands demons to print something to the console. The console is the bottom pane of Dr. Java, or in the Windows '''Command Prompt''' application. The muggle textbook tells how to do the latter in chapter 2.4. | ||
− | Now comes the wierdness! | + | ==(B) Now comes the wierdness!== |
* Remove one of the curly braces, save,compile and run. | * Remove one of the curly braces, save,compile and run. | ||
Line 33: | Line 34: | ||
* They are always true, but are they ever helpful? | * They are always true, but are they ever helpful? | ||
− | + | ==(C) Trial by fire!== | |
* Restore the unindented version of HelloGraphics from the previous class. | * Restore the unindented version of HelloGraphics from the previous class. |