@@ -561,7 +561,8 @@ \section{The hello world program}
561561% more precise, but also to reduce the number of times ``print'' appears,
562562% which is a lot!
563563
564- \begin {trinket }{Hello.java}
564+ % height = 130 + 15 * num_lines
565+ \begin {trinket }[235]{Hello.java}
565566public class Hello {
566567
567568 public static void main(String[] args) {
@@ -651,7 +652,7 @@ \section{Displaying strings}
651652You can put as many statements as you like in \java {main}.
652653For example, to display more than one line of output:
653654
654- \begin {trinket }{Hello.java}
655+ \begin {trinket }[250] {Hello.java}
655656public class Hello {
656657
657658 public static void main(String[] args) {
@@ -679,7 +680,7 @@ \section{Displaying strings}
679680\java {System.out.println} appends a special character, called a {\bf newline}, that moves to the beginning of the next line.
680681If you don't want a newline at the end, you can use \java {print} instead of \java {println}:
681682
682- \begin {trinket }{Goodbye.java}
683+ \begin {trinket }[235] {Goodbye.java}
683684public class Goodbye {
684685
685686 public static void main(String[] args) {
@@ -700,7 +701,7 @@ \section{Escape sequences}
700701It is possible to display multiple lines of output in just one line of code.
701702You just have to tell Java where to put the line breaks.
702703
703- \begin {trinket }{Hello.java}
704+ \begin {trinket }[220] {Hello.java}
704705public class Hello {
705706
706707 public static void main(String[] args) {
@@ -775,7 +776,7 @@ \section{Formatting code}
775776But most other spaces are optional.
776777For example, this program is legal:
777778
778- \begin {trinket }{Goodbye.java}
779+ \begin {trinket }[220] {Goodbye.java}
779780public class Goodbye {
780781public static void main(String[] args) {
781782System.out.print("Goodbye, ");
@@ -787,7 +788,7 @@ \section{Formatting code}
787788The newlines are optional, too.
788789So we could just write:
789790
790- \begin {trinket }{Goodbye.java}
791+ \begin {trinket }[175] {Goodbye.java}
791792public class Goodbye { public static void main(String[] args)
792793{ System.out.print("Goodbye, "); System.out.println
793794("cruel world");}}
@@ -1661,7 +1662,7 @@ \section{Types of errors}
16611662Error messages from the compiler usually indicate where in the program the error occurred, and sometimes they can tell you exactly what the error is.
16621663As an example, let's get back to the hello world program from Section~\ref {hello }.
16631664
1664- \begin {trinket }{Hello.java}
1665+ \begin {trinket }[235] {Hello.java}
16651666public class Hello {
16661667
16671668 public static void main(String[] args) {
@@ -1753,7 +1754,7 @@ \section{Types of errors}
17531754Instead, it will do exactly what you told it to do.
17541755For example, here is a version of the hello world program with a logic error:
17551756
1756- \begin {trinket }{Hello.java}
1757+ \begin {trinket }[235] {Hello.java}
17571758public class Hello {
17581759
17591760 public static void main(String[] args) {
@@ -2833,7 +2834,7 @@ \section{Adding new methods}
28332834You have probably guessed by now that you can define more than one method in a class.
28342835Here's an example:
28352836
2836- \begin {trinket }{NewLine.java}
2837+ \begin {trinket }[310] {NewLine.java}
28372838public class NewLine {
28382839
28392840 public static void newLine() {
@@ -3008,7 +3009,7 @@ \section{Parameters and arguments}
30083009The parameter list indicates what arguments are required.
30093010The following class shows an example:
30103011
3011- \begin {trinket }{PrintTwice.java}
3012+ \begin {trinket }[295] {PrintTwice.java}
30123013public class PrintTwice {
30133014
30143015 public static void printTwice(String s) {
@@ -3128,7 +3129,7 @@ \section{Stack diagrams}
31283129
31293130Pulling together the code fragments from the previous section, here is a complete class definition:
31303131
3131- \begin {trinket }{PrintTime.java}
3132+ \begin {trinket }[340] {PrintTime.java}
31323133public class PrintTime {
31333134
31343135 public static void printTime(int hour, int minute) {
0 commit comments