You are on page 1of 42

(eBook PDF) Murach's Java

Programming 5th Edition by Joel


Murach
Visit to download the full and correct content document:
https://ebooksecure.com/download/ebook-pdf-murachs-java-programming-5th-edition
-by-joel-murach/
A CORE JAVA BOOK
that teaches you the Java essentials
using the time-sa,~ng features of an IDE

AN OBJECT-ORIENTED BOOK
d1at shO\VS you ho,v to use business classes,
inheritance, and interfaces d1e \vay they're
used in the real world

A GUI PROGRAMMING BOOK


that sho,vs you ho,v to develop graphical user
interfaces that handle events and validate data

A DATABASE PROGRAMMING BOOK


that sho,vs you ho,v to develop 3-tiered,
object-oriented, database applications
the ,vay the pros do it
Expanded contents vii

Expanded contents
Section 1 Essentia l skills
Chapter 1 An introduction to Java
An overview of Java ............................................................................ 4
Java timeline .................................................................................................................... 4
Java editions .................................................................................................................... 4
How Java compares to C++ and C# ................................................................................ 6
Types of Java applications ................................................................ 8
Two types of desktop applications .................................................................................. 8
Web applications and mobile apps ................................................................................ IO
An introduction to Java development............................................. 12
The code for a console appl ication .. .............................................................................. 12
How Java compiles and interprets code ........................................................................ 14
An introduction to Java IDEs ........................................................................................ 16
How to use NetBeans to work with existing projects ................... 18
An introduction to NetBeans ......................................................................................... 18
How to open, close, and delete a project.. ..................................................................... 20
How to compile and run a project ................................................................................. 20
How to use the Output window with a console application .......................................... 22
How to work w ith two or more projects........................................................................ 24
How to use NetBeans to develop new projects ............................. 26
How to create a new project .......................................................................................... 26
How to work with Java source code and ti les ............................................................... 28
How to use the code completion feature ....................................................................... 30
How to detect and correct syntax errors ........................................................................ 32

Chapter 2 How to write your first Java applications


Basic coding skills ............................................................................ 38
How to code statements ................................................................................................. 38
How to code comments ................................................................................................. 38
How to create identifiers ...............................................................................................40
How to declare a class and a main method ................................................................... 42
How to work with numeric variables ............................................... 44
How to declare and initialize variables ......................................................................... 44
How to code assignment statement~ .............................................................................. 44
How to code arithmetic expressions .............................................................................. 46
How to work with string variables ................................................... 48
How to create a String object ........................................................................................48
How to join and append strings ..................................................................................... 48
How to include special characters in strings ................................................................. 50
How to use classes, objects, and methods ................................... 52
How to import classes ................................................................................................... 52
How to create objects and cal I methods ........................................................................ 54
How to view the AP! documentation ............................................................................ 56
How to use the console for input and output ................................ 58
How to print output to the console ................................................................................ 58
How to read input from the console .............................................................................. 60
Examples that get input from the console ..................................................................... 62
viii Expanded contents

How to code simple control statements ......................................... 64


How to compare numeric variables ............................................................................... 64
How to compare string variables ................................................................................... 64
How to code if/else statements ...................................................................................... 66
How to code while statements ....................................................................................... 68
Two illustrative applications ............................................................ 70
The Invoice application ................................................................................................. 70
The Test Score appl ication ............................................................................................ 72
How to test and debug an application ............................................ 74
How to test an application ............................................................................................. 74
How to debug an application ......................................................................................... 74

Chapter 3 How to work with the primitive data types


Basic skills for working with data ................................................... 82
The eight primitive data types ....................................................................................... 82
How to declare and initialize variables ......................................................................... 84
How to declare and initialize constants ......................................................................... 86
How to code arithmetic expressions .............................................. 88
How to use the binary operators .................................................................................... 88
How to use the unary operators ..................................................................................... 90
How to use the compound assignment operators .......................................................... 92
How to work with the order of precedence ................................................................... 94
How to work with casting ............................................................................................. 96
How to use the Java Shell to test code .......................................................................... 98
How to use Java classes to work with numbers .......................... 100
How to use the Integer and Double classes ................................................................. I00
How to use the Math class ........................................................................................... I02
How to use the NumberFom1at class .......................................................................... I04
The Invoice application w ith formatting ..................................................................... I06
How to debug a rounding error ................................................................................... 108
How to use the BigDecimal class .................................................. 11 0
The constructors and methods ..................................................................................... 110
Exan1ples that work with the BigDecimal class .......................................................... 112
The Invoice application w ith BigDecimal obj ects ...................................................... 114

Chapter 4 How to code control statements


How to code Boolean expressions ............................................... 120
How to compare primitive data types .......................................................................... 120
How to use the logical operators ................................................................................. 122
How to code if/ else and switch statements ................................. 124
How to code if/else statements .................................................................................... 124
How to code switch stateme nts ................................................................................... 128
The Invoice application w ith a switch statement ........................................................ 132
How to code loops .......................................................................... 134
How to code while loops ............................................................................................. 134
How to code do-while loops ........................................................................................ 136
How to code for loops ................................................................................................. 138
The Future Value application ...................................................................................... 140
How to code nested loops ............................................................................................ 142
How to code break and continue statements .............................. 144
How to code break statements ..................................................................................... 144
How to code continue statements ................................................................................ 144
The Guess the Number application ............................................................................. 146
Expanded contents ix

Chapter 5 How to code methods, handle exceptions,


and validate data
How to code and call static methods............................................ 152
How to code static methods ........................................................................................ 152
How to call static method~ .......................................................................................... 152
The Future Value application with a static method ..................................................... 154
The Guess the Number appl ication with static methods ............................................. 156
How to handle exceptions .............................................................. 158
How exceptions work .................................................................................................. 158
How to catch exceptions ............................................................................................. 160
The Future Value application with exception handling ............................................... 162
How to val id ate d ata ....................................................................... 164
How to prevent exceptions from being thrown ........................................................... 164
How to validate a single entry ..................................................................................... 166
How to code a method that validates an entry ............................................................. 168
The Future Va lue application with data validation ...................... 170
The console ................................................................................................................. 170
The code ...................................................................................................................... 172

Chapter 6 How to test, debug, and deploy an application


Basic skills for testing and debugging ......................................... 180
Typical test phases ....................................................................................................... 180
The three types of errors ............................................................................................. 180
Common Java errors .................................................................................................... 182
A s imple way to trace code execution ......................................................................... 184
How to use NetBeans to debug an application ........................... 186
How to set and remove breakpoints ............................................................................ 186
How to step through code ............................................................................................ 188
How to inspect variables ............................................................................................. 188
How to inspect the stack trace ..................................................................................... 190
How to deploy an application ........................................................ 192
An introduction to deployment ................................................................................... 192
How to create an executable JAR file .......................................................................... 194
How to deploy the files for an appl ication .................................................................. 196
How to run a GUI application ..................................................................................... 196
How to run a console application ................................................................................ 198

Section 2 Object-oriented programming


Chapter 7 How to define and use classes
An introduction to classes ............................................................. 208
How classes can be used to structure an application ................................................... 208
How encapsulation works ........................................................................................... 210
The relationship between a class and its objects ......................................................... 212
How to work with a class that defines an object ......................... 214
How to use NetBeans to create a new class ................................................................ 214
The Product class ........................................................................................................ 216
How to code instance variables ................................................................................... 218
How to code constructors ............................................................................................ 220
How to code methods .................................................................................................. 222
How to create an object from a class ........................................................................... 224
X Expanded contents

How to call the methods of an object. ......................................................................... 226


How to use NetBeans to work with classes ................................................................. 228
How to code and use static fields and methods ......................... 230
How to code static fields and methods ........................................................................ 230
How to call static fields and methods .......................................................................... 232
How to code a static initialization block ..................................................................... 234
When to use static fie lds and method~ ........................................................................ 234
The Product Viewer application .................................................... 236
The ProductDB class ................................................................................................... 236
The user inte,face and the ProductApp class .............................................................. 238
More skills for working with objects and methods ..................... 240
Reference types compared to primitive types ............................................................. 240
How to overload med1od~ ............................................................................................ 242
How to use the this keyword ....................................................................................... 244
The Line Item application ............................................................... 246
The user inte,face ........................................................................................................ 246
The class diagran1........................................................................................................ 246
The code for the classes .............................................................................................. 248

Chapter 8 How to work with inheritance


An introduction to inheritance ...................................................... 260
How inheritance works ................................................................................................ 260
How the Object class works ........................................................................................ 262
Basic skills for working with inheritance ..................................... 264
How to create a superclass .......................................................................................... 264
How to create a subclass ............................................................................................. 266
How polymorphism works .......................................................................................... 268
The Product application ................................................................. 270
The console ................................................................................................................. 270
The Product, Book, and Software classes ................................................................... 272
The ProductDB class ................................................................................................... 272
The ProductApp class ................................................................................................. 276
More skills for working with inheritance ...................................... 278
How to cast object~ ..................................................................................................... 278
How to compare objects .............................................................................................. 280
How to work with the abstract and final keywords ..................... 282
How to work with the abstract keyword...................................................................... 282
How to work with the final keyword ........................................................................... 284

Chapter 9 How to define and use interfaces


An introduction to interfaces ......................................................... 292
A s imple interface ....................................................................................................... 292
Interfaces compared to abstract classes ....................................................................... 294
Basic skills for working with interfaces ....................................... 296
How to code an interface ............................................................................................. 296
How to implement an inte1face ................................................................................... 298
How to inherit a class and implement an interface ..................................................... 300
How to use an inte1face as a parameter ....................................................................... 302
How to use inheritance with interfaces ....................................................................... 304
How to use NetBeans to work with interfaces ............................................................ 306
Expanded contents Xi

New features for working with interfaces .................................... 308


How to work w ith default methods ............................................................................. 308
How to work w ith static methods ................................................................................ 310
The Product Viewer application .................................................... 312
The console ................................................................................................................. 312
The ProductReader interface ....................................................................................... 312
The ProductDB class ................................................................................................... 312
The ProductApp class ................................................................................................. 314
How to implement the Cloneable interface .................................. 316
A Product class that implements the Cloneable interface ........................................... 316
A Lineltem class that implements the Cloneable interface ......................................... 318

Chapter 1 O More object-oriented programming skills


How to work with packages ........................................................... 324
An introduction to packages ........................................................................................ 324
How to work w ith packages ........................................................................................ 326
How to work w ith libraries .......................................................................................... 328
How to work with modules ............................................................. 330
An introduction to the module syste m ........................................................................ 330
How to create modules ................................................................................................ 332
How to use modules .................................................................................................... 334
How to use javadoc to document a package ............................... 336
How to add javadoc comments to a class .................................................................... 336
How to use HTML andjavadoc tags in javadoc comment~ ........................................ 338
How to generate documentation .................................................................................. 340
How to view the documentation for a package ........................................................... 340
How to work with enumerations .................................................... 342
How to declare an enumeration ................................................................................... 342
How to use an enumeration ......................................................................................... 342
How to enhance an enumeration ................................................................................. 344
How to work w ith static imports ................................................................................. 344

Section 3 More essential skills


Chapter 11 How to work with arrays
Basic skills for working with arrays .............................................. 354
How to create an array ................................................................................................ 354
How to assign values to the elements of an array ....................................................... 356
How to use for loops with arrays ................................................................................ 358
How to use enhanced for loops with arrays ................................................................ 360
How to use the Arrays class .......................................................... 362
How to till, sort, and search arrays .............................................................................. 362
How to refer to, copy, and compare arrays.................................................................. 364
How to implement the Comparable interface ............................................................. 366
The Number Cruncher application .............................................................................. 368
How to work with two -dimensional arrays ................................... 370
How to work w ith rectangular arrays .......................................................................... 3 70
How to work w ith jagged arrays ................................................................................. 3 72
xii Expanded contents

Chapter 12 How to work w ith collections and generics


An introduction to collections ...................................................... 380
A comparison of arrays and collections ...................................................................... 380
An overview of the Java collection framework ........................................................... 382
An introduction to generics ......................................................................................... 384
How to work with an array list ....................................................... 386
How to create an array list.. ......................................................................................... 386
How to add and get elements ...................................................................................... 388
How to replace, remove, and search for elements ....................................................... 390
How to store primitive types in an array list ............................................................... 392
The Invoice application .................................................................. 394
The console ................................................................................................................. 394
The Invoice class ......................................................................................................... 396
The InvoiceApp class .................................................................................................. 398
How to work with a linked list ........................................................400
How to create a linked list and add and get element~ ................................................. 400
How to replace, remove, and search for elements ....................................................... 402
How to use the methods of the Queue and Deque inte1faces ...................................... 404
A class that uses generics and a linked list to define a queue ..................................... 406
How to work with maps .................................................................. 408
The HashMap and TreeMap classes ............................................................................ 408
Code examples that work with maps ........................................................................... 410
The 'Nord Counter application .................................................................................... 412

Chapter 13 How to work w ith strings


How to work with the String class ................................................. 420
How to create strings ................................................................................................... 420
How to join strings ...................................................................................................... 420
How to append data to a string .................................................................................... 420
How to compare strings ............................................................................................... 422
How to work with string indexes ................................................................................ 424
How to modify strings ................................................................................................. 426
How to work with the StringBuilder class .................................... 428
How to create a StringBuilder object .......................................................................... 428
How to append data to a string .................................................................................... 428
How to modify strings ................................................................................................. 430
The Product Lister application ...................................................... 432
The user inte,face ........................................................................................................ 432
The StringUtil class ..................................................................................................... 432
The ProductListerApp class ........................................................................................ 434

Chapter 14 How to work w ith dates and t imes


An introduction to date/time APl s ................................................ 440
The date/time API prior to Java 8 ................................................................................ 440
The date/time API for Java 8 and later ........................................................................ 440
How to use the new date/time API ................................................ 442
How to create date and time object~ ............................................................................ 442
How to get date and time parts .................................................................................... 444
How to compare dates and times ................................................................................. 446
How to adjust dates and times ..................................................................................... 448
How to add or s ubtract a period of time ...................................................................... 450
How to get the time between two dates ....................................................................... 450
How to format dates and times .................................................................................... 452
An Invoice class that includes an invoice date ............................................................ 454
Expanded contents xiii

Chapter 15 How to work with file 1/ 0


Introduction to directories and files ............................................. 460
A package for working with directories and ti les ....................................................... 460
Code examples that work with directories and ti les .................................................... 462
Introduction to file 1/ 0 .................................................................... 464
How tiles and streams work ........................................................................................ 464
A tile 1/0 example ....................................................................................................... 466
How to work w ith 1/0 exceptions ............................................................................... 468
How to work with text files ............................................................. 470
How to connect a character output stream to a ti le ..................................................... 470
How to write to a text tile ............................................................................................ 472
How to connect a character input stream to a tile ....................................................... 474
How to read from a text ti le ........................................................................................ 476
Two interfaces for data access ..................................................................................... 478
A class that works with a text ti le ............................................................................... 480
The Product Manager application ................................................. 484
The console ................................................................................................................. 484
The ProductManagerApp class ................................................................................... 484
How to work with binary files ........................................................ 488
How to connect a binary output stream to a tile .......................................................... 488
How to write to a binary tile ........................................................................................ 490
How to connect a binary input stream to a ti le ............................................................ 492
How to read from a binary ti le .................................................................................... 494
A class that works with a binary ti le ........................................................................... 494

Chapter 16 How to work with exceptions


An introduction to exception s ....................................................... 502
The exception hierarchy .............................................................................................. 502
How exceptions are propagated .................................................................................. 504
How to catch exceptions ................................................................506
How to use the try statement. ...................................................................................... 506
How to use the try-with-resources statement. ............................................................. 508
How to use the method~ of an exception ..................................................................... 510
How to use a multi-catch block ................................................................................... 512
How to throw exc.e ptions ............................................................... 514
How to use the throws clause ...................................................................................... 514
How to use the throw statement .................................................................................. 516
How to work with custom exceptions ........................................... 518
How to create a custom exception class ...................................................................... 518
How to use exception chaining ................................................................................... 520
An interface d1at uses custom exceptions ................................................................... 522
A class that uses custom exceptions ............................................................................ 522

Chapter 17 How to get started with JavaFX


An introduction to GUI programming ........................................... 532
A GUI that displays ten controls ................................................................................. 532
A summary of GUI APis ............................................................................................. 532
The inheritance hierarchy for JavaFX nodes ............................................................... 534
How to create a GUI that accepts user input ............................... 536
How to create and display a w indow ........................................................................... 536
How to work w ith labels ............................................................................................. 538
xiv Expanded contents

How to set alignment and padding .............................................................................. 540


How to work with text fields ....................................................................................... 542
How to set colu,nn widths ........................................................................................... 544
How to create a GUI that handles events ..................................... 546
How to work with buttons and boxes .......................................................................... 546
How to handle action events ....................................................................................... 548
The Future Va lue application ......................................................... 550
The user inte,face ........................................................................................................ 550
The code ...................................................................................................................... 550
How to validate user input ............................................................. 554
How to display an error message in a dialog box ....................................................... 554
How to validate the data entered into a text field ........................................................ 556
The Validation class..................................................................................................... 558
How to validate multiple entries ................................................................................. 560
How to get started with FXML ....................................................... 562
An introduction to XML ............................................................................................. 562
How to code an FXML application ............................................................................. 564
How to create the tiles for an FXML application ........................................................ 564
The Future Va lue application with FXML ...................................... 566
The FXML tile ............................................................................................................ 566
The controller class ..................................................................................................... 568
The application class ................................................................................................... 568

Chapter 18 How to get started with Swing


An introduction to GUI programming ........................................... 574
A user interface with ten contro ls ............................................................................... 574
A s ummary of GUI APis ............................................................................................. 574
The inheritance hierarchy for Swing component~ ...................................................... 576
How to create a GUI that handles events ..................................... 578
How to display a frame ............................................................................................... 578
How to set the look and feel.. ...................................................................................... 580
How to work with panels ............................................................................................ 582
How to work with buttons ........................................................................................... 582
How to handle action events ....................................................................................... 584
How to work with labels ............................................................................................. 586
How to work with text fields ....................................................................................... 588
How to work with layout managers ............................................... 590
A s ummary of layout managers .................................................................................. 590
How to use the FlowLayout manager.......................................................................... 592
How to use the BorderLayout manager ....................................................................... 594
How to use the GridBagLayout manager .................................................................... 596
How to add padding to a GridBagLayout ................................................................... 598
How to solve a common problem with the GridBagLayout ....................................... 600
The Future Va lue application ......................................................... 602
The user inte,face ........................................................................................................ 602
The code ...................................................................................................................... 602
How to validate Swing input data .................................................. 608
How to display a dialog box ........................................................................................ 608
How to validate the data entered into a text field ........................................................ 610
The Validation class..................................................................................................... 612
How to validate multiple entries ................................................................................. 614
Expanded contents XV

Chapter 19 More Swing controls


More skills for working with controls ........................................... 620
How to work w ith text areas ........................................................................................ 620
How to add scroll bars ................................................................................................. 620
How to work w ith check boxes ................................................................................... 622
How to work w ith radio buttons .................................................................................. 624
How to add a border and title ...................................................................................... 626
How to work w ith combo boxes.................................................................................. 628
How to work w ith lists ................................................................................................ 630
How to work w ith list models ..................................................................................... 632
The Payment application................................................................ 634
The user inte,face ........................................................................................................ 634
The code ...................................................................................................................... 636

Section 5 Database programming ~~~~~~~~~~~~~~

Chapter 20 An introduction to databases with SQLite


How a relational database is organized ....................................... 650
How a table is organized ............................................................................................. 650
How the columns in a table are defined ...................................................................... 650
How tables are related ................................................................................................. 652
How to use SQL to work with a database..................................... 654
How to query a s ingle table ......................................................................................... 654
How to join data from two or more tables .................................................................. 656
How to add, update, and delete data in a table ............................................................ 658
How to use SQLite Manager .......................................................... 660
An introduction to SQLite........................................................................................... 660
How to connect to a SQLite database ......................................................................... 662
How to work w ith a SQLite database.......................................................................... 662
How to execute SQL statements ................................................................................. 664
How to create a SQLite database ................................................................................ 666

Chapter 21 How to use JDBC to work with a database


An introduction to database drivers ............................................. 672
Four types of JDBC database drivers .......................................................................... 672
How to download a database driver ............................................................................ 6 72
How to add a database driver to a project ................................................................... 6 74
How to work with a database ......................................................... 676
How to connect to a database ...................................................................................... 676
How to return a result set and move the cursor through it .......................................... 6 78
How to get data from a result set.. ............................................................................... 680
How to insert, update, and delete data ........................................................................ 682
How to work w ith prepared statements ....................................................................... 684
A class for working with databases .............................................. 686
The DAO inte,face ...................................................................................................... 686
The ProductDB class ................................................................................................... 686
Code that uses the ProductDB class ............................................................................ 692
xvi Expanded contents

Section 6 Advanced skills


Chapter 22 How to work w ith lambda expressions and streams
How to work with lambda expressions ......................................... 700
Anonymous classes compared to lambdas .................................................................. 700
Pros and cons of lambda expressions .......................................................................... 700
A method that doesn' t use lambdas ............................................................................. 702
A method that uses lambdas ........................................................................................ 704
The syntax of a lambda expression ............................................................................. 706
How to use functional interfaces from the Java API ................... 708
How to use the Predicate interface .............................................................................. 708
How to use the Consumer interface ............................................................................ 710
How to use the Function interface ............................................................................... 712
How to work with multiple functional interfaces ........................................................ 714
How to work with streams.............................................................. 716
How to ti lter a list.. ...................................................................................................... 716
How to map a list ........................................................................................................ 718
How to reduce a list.. ................................................................................................... 720

Chapter 23 How to work w ith threads


An introduction to threads ............................................................. 726
How threads work ....................................................................................................... 726
Typical uses for thread~ ............................................................................................... 726
Classes and interfaces for working with thread~ ......................................................... 728
The life cycle of a thread ............................................................................................. 730
Two w·a ys to create th reads ........................................................... 732
Constructors and methods of the Thread class ............................................................ 732
How to extend the Thread class .................................................................................. 734
How to implement the Runnable interface .................................................................. 736
How to synchronize threads .......................................................... 738
How to use synchronized methods .............................................................................. 738
When to use synchronized methods ............................................................................ 738

Appendix A How to set up Windows for this book


How to install the JDK and NetBeans ......................................................................... 744
How to install the source code for this book ............................................................... 746
How to install Eclipse ................................................................................................. 748
How to install SQLite Manager .................................................................................. 750

Appendix B How to set up Mac OS X for this book


How to install the JDK and NetBeans ......................................................................... 754
How to install the source code for this book ............................................................... 756
How to install Eclipse ................................................................................................. 758
How to install SQLite Manager .................................................................................. 760
Introduction
Since its release in 1996, the Java language has established itself as one of
the leading languages for object-oriented progran1ming. Today, Java continues to
be one of the most popular languages for application developn1ent, especially for
web and mobile applications, like Android apps. And that 's going to continue for
many years to come, for several reasons.
First, developers can obtain Java and a wide variety of tools for working
with Java for free. Second, Java code can run on any modem operating system.
Third, Java is used by many of the largest enterprises in the world. Fotuth, Java's
developn1ent has always been guided by the Java con1munity. As a result, the
Java platform is able to evolve according to the needs of the progran1mers who
use the language.

Who this book is for


This book is for anyone who wants to learn the core features of the Java
language. It works if you have no programn1ing experience at all. It works if you
have progra1nrning experience with another language. It works if you already
know an older version of Java and you want to get up-to-speed with the latest
version. And it \VOrks if you've already read three or four other Java books and
still don't know how to develop a real-world application.
If you're con1pletely new to progran1ming, the prerequisites are minimal.
You just need to be familiar with the operation of the platform that you're using
(like Windows, Mac OS X, or Linux) so you can perform tasks like opening,
saving, prin6ng, closing, copying, and deleting files.

What version of Java this book supports


This book shows how to use Java SE 9, which includes JDK (Java
Developn1ent Kit) 9. Ho\vever, since all versions of Java are backwards
con1patible, the code and skills presented in this book \Vill \vork with later
versions too. Besides that, this book clearly identifies when Java introduced its
most recent features . That way, you can avoid these features if you want yotu
code to work with earlier versions of Java.
xviii Introduc1io11

What IDEs this book supports


This book supports two of the most popular IDEs (Integrated Development
Environn1ents) for working with Java, NetBeans and Eclipse. Both of these IDEs
are available for free and run on all operating systems.
To support both ID Es, the printed pages sho\11 how to use NetBeans, and the
download for this book includes a PDF file that shows how to use Eclipse. In
addition, this download includes the source code for this book forn1atted for both
NetBeans and Eclipse. As a result, it's easy to use either IDE \ltith this book.

How to get the software you need


You can download all of the soft\l1are that you need for this book for free
fron1 the Internet. To n1ake that easier for you, appendix A shO\ltS hov, to
download and install this software on Windows, and appendix B shows how to
download and install this software on Mac OS X.

How this book helps you learn


Like all our books, this one has feattU"es that you won't find in con1peting
books. That's why we believe that you'll learn faster and better with our book
than with any other. Here are just so111e of those features.
• Unlike n1any Java books, this book shows you how to use an IDE to develop
Java applications. That's ho\11 Java programming is done in the real world,
and that by itself will help you learn faster.
• Unlike n1any Java books, this one focuses on the Java features that you will
use every day. As a result, it doesn't waste your time by presenting features
that you probably won't ever need.
• To help you learn how to develop applications at a professional level,
this book presents complete, non -trivial applications. For example,
chapter 15 presents a Product Manager application that uses presentation
classes, business classes, and database classes to in1plement the three-tier
architecture. You won't find complete, real-v,orld applications like this in
other Java books, even though studying these types of applications is the
best way to master Java development.
• The exercises at the end of each chapter give you a chance to try out \Vhat
you've just learned. They guide you through the development of son1e
applica6ons, and they challenge you to apply what you've learned in
new \vays. As a result, you'll gain valuable, hands-on experience in Java
programming that will build your skills and your confidence.
• All of the inforn1ation in this book is presented in our unique paired-pages
format, with the essential syntax, guideli nes, and examples on the right page
and the perspective and extra explanation on the left page. This helps you
learn more while reading less, and it helps you quickly fi nd the information
that you need when you use this book for reference.
/111roductio11 xix

How our downloadable files help you learn


If you go to our website at www.murach.com, you can download all the files
that you need for getti ng the most from this book, in both NetBeans and Eclipse
forn1at. These files include:
• All of the applications presented in this book
• The starting code for the exercises that are at the end of each chapter
• The solutions to the exercises
These files Jet you test, reviev,, and copy the code. In addition, if you have any
problems with the exercises, the solutions are there to help you over the learning
blocks, which is an essential part of the learning process. For more information
on downloading and installing these files, please see appendix A (Windows) or
appendix B (Mac OS X).

Support materials for instructors and trainers


If you 're a college instructor or corporate trai ner who would like to use this
book as a course text, we offer a full set of the support materials you need for a
turnkey cotu-se. That includes:
• Instructional objectives that help your students focus on the skills that they
need to develop
• Dozens of projects that let your students prove how well they have n1astered
those skills
• Test banks that let you measure how well your students have mastered those
skills
• A complete set of Power Point slides that you can use to reviev, and
reinforce the content of the book
To learn more about otu- instructor's materials, please go to our website at
www.murachforinstructors.com if you're an instructor. Or if you're a trainer,
please go to www.mw·ach.com and click on the Course1vare for Trainers link, or
contact Kelly at l -800-221-5528 or kelly@murach.com.

Companion books
When you finish this book, you'll have all of the Java skills that you need
for moving on to web or mobile programn1ing with Java. Then, if you \Vant to
move on to web progranuning, Murach's Java Servlets and ISP will show you
ho\v to use Java servlets and Java Server Pages to develop professional web
applications. Or, if you want to move on to Android programming, Murach's
Android Prograrnming will get you started with that.
XX lntroduc1io11

Please let us know what you think of this book


When we started the first edition of this book, our goals were ( 1) to teach
you Java as quickly and easily as possible and (2) to teach you the practical
Java concepts and skills that you need for developing real-world business
applica6ons. We 've tried to improve on that with each subsequent edition, and as
this 5th edition goes to press, we hope that the book is n1ore effective than ever
before. Many of the improven1ents have con1e from the feedback we've received
from Otll" readers, so if you have any con1ments about this book, we would
appreciate hearing from you at murachbooks@murach.com.
Thanks for buying this book. We hope you enj oy reading it, and we wish you
great success with your Java programn1ing.

~~l ~Author
~'J3odnc
Anne Boehm
Editor
Section 1

Essential skills
This section gets you started quickly with Java programming. First, chapter
1 introduces you to Java applications and shows you how to use an IDE
to \VOrk \vith Java projects. Then, chapter 2 shows you how to write your
first Java applications. When you complete these chapters, you' ll be able to
write, test, and debug simple applications of your O\vn.
After that, chapter 3 presents the details for working with the eight
primitive data types. Chapter 4 presents the details for coding control
staten1ents. Chapter 5 shows how to code n1ethods, handle exceptions, and
validate data. And chapter 6 shows ho\v to thoroughly test and debug an
application. In addi6on, it shows how to deploy an application.
These are the essential skills that you'll use in almost every Java
application that you develop. When you finish these chapters, you' ll be able
to write solid programs of your own. And you'll have the background that
you need for learning how to develop object-oriented progran1s.
1

An introduction to Java
This chapter starts by presenting some background inforn1ation about Java.
This information isn't essential to developing Java applications, so you
can skin1 it if you \Vant. However, it does show how Java works and how it
con1pares to other languages.
After the background information, this chapter shows how to use the
NetBeans IDE (Integrated Development Environn1ent) to work with a Java
application. For this book, we recon1mend using NetBeans because \Ve think
it's the best and most intuitive IDE for getting started with Java.
However, Eclipse is another great IDE for working \vith Java
applications, and many progra111mers prefer it. As a result, the download for
this book includes a PDF file that shows how to use Eclipse \vith this book
instead of NetBeans. So, if you want to use Eclipse, you can use this PDF file
whenever you need to learn how to perfor111 a task with Eclipse.

An ove rv iew of Java ............................................................... 4


Java timeline ....................................................................................................4
Java editions .....................................................................................................4
How Java compares to C++ and C# ................................................................6
Types of Java applications .................................................... 8
Two types of desktop appl ications ...................................................................8
Web applications and mobile apps ................................................................ 10
An introduction to Java development ................................ 12
The code for a console appl ication ................................................................ 12
How Java compiles and interprets code ........................................................ 14
An introduction to Java IDEs ........................................................................ 16
How to use NetBeans to work with exi sting projects ....... 18
An introduction to NetBeans ......................................................................... 18
How to open, close, and delete a project .......................................................20
How to compile and run a project .................................................................20
How to use the Output window with a console appl ication ..........................22
How to work with two or more projects ....................................................... 24
How to use NetBeans to develop new projects ................26
How to create a new project ..........................................................................26
How to work with Java source code and files ................................................28
How to use the code completion feature .......................................................30
How to detect and correct syntax errors........................................................ 32
Perspective ........................................................................... 34
Another random document with
no related content on Scribd:
The Project Gutenberg eBook of Papurikko-
valakka. Ukkovaari
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.

Title: Papurikko-valakka. Ukkovaari


Kaksi novellia

Author: Sándor Petőfi

Translator: Meri Sulju

Release date: September 5, 2023 [eBook #71573]

Language: Finnish

Original publication: Hämeenlinna: Arvi A. Karisto, 1909

Credits: Tuula Temonen

*** START OF THE PROJECT GUTENBERG EBOOK PAPURIKKO-


VALAKKA. UKKOVAARI ***
PAPURIKKO JA VALAKKA. UKKOVAARI

Kaksi novellia

Kirj.

ALEKSANTERI PETÖFI

Suomentanut

Meri Sulju

Kirjallisia pikkuhelmiä XIII.

Hämeenlinnassa, Arvi A. Karisto, 1909.

SISÄLTÖ:

I. Aleksanteri Petöfi.
II. Papurikko ja valakka.
III. Ukkovaari.
Aleksanteri Petöfi.

Aleksanteri Petöfi (unkaril. kirjotustavan mukaan Petöfi Sandor),


Unkarin suurin ja kansallisin runoilija, syntyi Ris-Rörössä lähellä
Pestiä, jouluk. 31 pnä 1823. Riitaannuttuaan isänsä kanssa,
keskeytti hän 1840 opintonsa ja lähti maailman kylille. Ensin rupesi
hän sotilaaksi, mutta heikkoutensa tähden pääsi vapaaksi ja alotti
kiertolaiselämänsä, kuleksi ympäri Unkaria jalkaisin, usein ilman
penniäkään taskussa, antautui palavalla innolla milloin mihinkin
teatteriseurueeseen, mutta aina ilman menestystä, opiskeli ja
lueskenteli väliin, kierteli taas, teki puhtaaksikirjotusta, käänteli
englannin ja ranskan kielistä ja alkoi julaista lehdissä runojaankin,
joilla heti saavutti suurta suosiota. Seikkailujensa jälkeen saapui hän
v. 1843 Pestiin jalkaisin, sauva kädessä ja runojen käsikirjotuksia
povessa.

Pestissä otettiin hänet suosiollisesti vastaan, hänen runojaan


painettiin ja hän sai aputoimittajan paikan eräässä muotilehdessä,
jossa työskenteli vuosikauden. Mutta kansa ihastui hänen runoihinsa
päivä päivältä, niitä alettiin laulaa ympäri katuja ja kyliä. Ja kun hän
taasen lähti kiertämään ympäri maatansa, otettiin hänet vastaan
kaikkialla riemusaatossa, ja teattereissa, jossa hänet näyttelijänä oli
vihelletty alas, otettiin hänet runoilijana vastaan seisoaltaan
kunnioittaen ja kansallishymniä laulaen. Näillä matkoillaan oppi hän
tuntemaan Julia Szendreyn, erään tilanomistajan tyttären, ja pitkien
ottelujen jälkeen pääsivät nuoret naimisiin 1847.

Mutta kauvan ei perheonnea oltu madjaarien kansan laulajalle


suotu. Tuli myrskyvuosi 1848. Ensin hän julkaisi tulta iskeviä
vallankumouslauluja, mutta pian heitti kynän nurkkaan, läksi sotaan
ja nousi pian majuriksi. V. 1849 nähtiin hänet viime kerran eräässä
taistelussa. Tietenkin hän siellä kaatui ja haudattiin hänet muiden
mukana joukkohautaan. Hänen elämänsä oli kuin salaman välähdys,
hänestä ei oikein tietty mistä hän tuli, vielä vähemmin, mihin hän
katosi.

Mutta hänen runoissaan salaman välähdykset elävät ijät kaiket,


niissä elää luonnontuores kukkastuoksu, kotoisempi
kansanomaisuus kuin kenenkään muun unkarilaisen kanteleessa on
helkähdellyt. Niitä on jo ennen pienonen vihko suomeksikin
käännetty. Tässä tutustutetaan suomalaista lukijaa pariin hänen
parhaaseen kertomukseensa. Niistäkin kimmeltää jumalainen
neronkipinä, niissä pienimpiäkin olentoja kultaa todellisen runouden
päivänsäteily. Toivottavasti ennen pitkää saadaan suomeksi
enemmänkin hänen kirjallisia helmiään, sillä useimmat niistä ovat
käännetyt vieraammillekin kuin "veljeskansan" kielelle.

Papurikko ja valakka.

Voi merkittyä!

Yksin ja hyljättynä seisoo hän maailmassa, kuten kaupungin


reunalla hirsipuu, jota jokainen karttaa kammosta tai inhosta. —
Mieliimme on juurtunut, että surkastuneessa ruumiissa täytyy
asustaa turmeltuneen sielun. "Paetkaa häntä kuin ruttoa!"
huudamme. — —

Martti parka! Hänenkään ei käynyt paremmin.


Hän oli kelpo poika, parempaa sydäntä ei ollut kellään; mutta
luonto oli rumentanut hänen kasvonsa ja ihmiset karttoivat häntä.

"Olkoon niin!" ajatteli hän. "Te minua vastaan — minä teitä


vastaan!"

Ja vastarinta alkoi…

Hänen isänsä oli suutarimestari Daniel Csigolya, joka nuoruutensa


päivinä oli ahertanut kokoon kohtalaisen varallisuuden.

Äkkiä pälkähti hänen päähänsä, kuinka kaunista olisikaan, jos hän


sepittäisi runojakin eikä ainoastaan kenkiä. Parasta näytti hänestä
olevan alottaa ottamalla tihkipäätä viinisiemaus, koska rypälemehu
oli paras runollisten mielialojen herättäjä; tällöin olivat hänestä
kaukana tunnonvaivat, että hän tuhlasi rahaa, päinvastoin hän sitä
vielä käärisi kokoon.

Daniel Csigolyan oli täytynyt olla sangen oppivainen ihminen,


koska hän juomataidossa pian pääsi mestariksi; ja se ei ole niinkään
helppoa, sen tiedän omasta kokemuksesta. Minun täytyy nimittäin
huomauttaa, että minäkin pyhitin näille opinnoille muutamia vuosia
siihen aikaan, jolloin suurta juopottelua vielä pidettiin hyveenä. Se
aika on mennyt — luojan kiitos — ja minä olen saavuttamani tiedot
unhottanut siinä määrin kuin en olisi niitä koskaan tiennytkään.

Poloiset ravintoloitsijat! Surkuttelen teitä sydämestäni, mutta yhtä


sydämestäni toivon, että hyvin monet seuraisivat esimerkkiäni.

Mutta kuten sanottu: herra Daniel Csigolya oli ahkera viinamäen


mies herran edessä. Ei kestänyt kauvan, kun hän jo joi vanhan
tuomarin ja kanttorin pöydän alle, ja nämä olivat, täällä kuten
kaikkialla, väkevimmät kapakkasankarit.

Ennenkuin vielä oli kaksi vuotta vierinyt, oli hänen omaisuutensa


hävitetty; talon osti raajarikko turkkuri, viinitarhan huusi
huutokaupassa kunnianarvoisa kirkkoherra. Vähitellen mentiin niin
pitkälle, että lestit ja muut työkalut vaelsivat nekin kapakkaan…

Rouva Csigolya oli säästäväinen, kelpo emäntä, joka ei


tietystikään iloinnut miehensä uudenlaatuisesta taloudenhoidosta.
Hän vuodatti katkeria kyyneleitä, kun hänen miehensä juopuneena
toikkaroi kotiin, ja valitti, kun sydämensä oli ylen täysi, väliin
naapurivaimoillekin hätäänsä. Miehensä edessä hän vaikeni, osaksi
sentähden, ettei hän oikein uskaltanut lausua nuhteita, osaksi, koska
hän ajatteli miehensä itsestään palaavan järkiinsä ja
velvollisuuksiensa täyttämiseen.

Hän odotti pitkän, pitkän aikaa — mutta turhaan!

Mutta vihdoin ei hän sentään voinut kärsiä sitä vaieten:

"Laupiaan Jumalan nimessä! Mies, mitä tästä on tuleva? Sinä juot


ja juot yhtä mittaa etkä enää koskaan työtä ajattelekaan."

Tämän puhuttelun aikana koetti Daniel pörhistää selälleen


viininraukaisemia silmäluomiaan, hän levitti hajalleen horjuvat
säärensä näyttääkseen mahtavammalta ja huusi sitten vakavalla
arvokkuudella:

"Hiljaa!"

"Rakas mies", jatkoi vaimo, "kun minä vihdoin puhun, niin tahdon
keventää sydämeni kaikesta siitä, mikä sitä rasittaa. Olen vaiennut
kyllin kauvan."

"Vaimo, älä poraa!"

"Mutta minun täytyy —"

"Vaikene!"

"Vaieta? Miksi?"

"Siksi, koska minä — koska — minä olen herra Daniel Csigolya."

"Ja minä olen rouva Sofie Csigolya."

"Vaimo! Älä napise taivasta vastaan. Pyhässä raamatussa seisoo


— mitä siellä seisookaan? — seisoo, että Jumala loi maailman
kuudessa päivässä, seitsemäntenä lepäsi hän. Sentähden asetu."

"En ennenkuin olen puhunut."

"Mitä? — Sinä tahdot puhua vielä? — Onko se totta vai leikkiä?"

"En ole nyt leikintekotuulella."

"No, koska se ei ole mitään leikkiä, tänne sitten partaveitsen kera,


että leikkaan kielesi pois."

"Ja vaikkapa. Minun täytyy puhua, koska — — —"

Julmistuneena karjui Daniel:

"Vaimo, nimesi on: vaiti!"

Samalla aikoi hän antaa vaimo raukalle iskun, joka ei kuitenkaan


sattunut paikalleen, niin että hän pyyhkäsi vaan päähineen pois.
Sitten heittäytyi hän tyydytettynä vuoteelle heti kohta kuorsaten kuin
raihnaisen sotilaan vanha piippu. Vaimo hiipi kyökkiin, valvoakseen
lieden ääressä itkien läpi yön.

Siten kuluivat päivät päästään. Mies oli juovuksissa, vaimo rukoili,


riiteli, torasi — lyhyesti, koetti kaikkensa johtaakseen hänet pois
harhapolultaan; mutta lopuksi kävi aina niin, että Daniel herra pakotti
julmistuneena vaimonsa olemaan vaiti. Vaimo älysi nyt kuinka kaikki
oli turhaa, hän ei itkenyt eikä valittanut enää, vaikeni, kun mies
palasi myöhään öisin juopuneena kotiin. Mutta mies oli sillä välin jo
tottunut iltaripitykseen, niin ettei hän voinut olla ilman sitä ja alkoi
rähistä, kun hänen vaimonsa ei virkannut sanaakaan.

Niin kuluivat päivät, niin katosivat yhä vähemmiksi myöskin tavarat


ja vihdoin astui autioon tupaan tuhlaavaisuuden nälkäinen, ryysyinen
lapsi — hätä! Se hiipi sisään kutsumattomana vieraana ja oli pian
talon valtiatar; ja tämä tapahtui aikaan, jolloin rouva Csigolya tunsi,
että pian tulisi kolmas huolehdittavaksi, siellä missä kahdenkin täytyi
kärsiä puutetta…

"Tuli ja leimaus!" murisi Csigolya, kun hän kuuli lähestyvästä


isänonnesta. "Tuli ja leimaus! — Nyt en voi antaa eukolle enää
kunnollisesti selkäänkään, sillä se voisi olla sikiöparalle pahaksi,
eikähän se voi mitään sille, että hänen äitinsä on sellainen — —
sellainen — —"

Hän etsi kauvan oikeaa sanaa, mutta ei löytänyt, vaikka paljon


ajattelemisen tähden alkoi aivan ruveta hänen päätään
huimaamaan.

— Silloin ajautui hänen mieleensä kysymys, miksi hän oikeastaan


antoi vaimolleen selkään.
— Ja silloin hämärteli hänen mielessään tunnustus, että hän
oikeastaan oli itse syypää siihen. Hän päätti vastaisuudessa pysyä
kapakkasakista loitolla.

Ja hän piti sanansa, hän karttoi kapakkaa, mutta — ei kauvan…

Eräänä päivänä poltti jano jälleen kirveltävänä hänen kurkkuaan;


mielellään olisi hän tämän hehkun sammuttanut, mutta talossa ei
ollut enää mitään, jolla olisi saattanut suorittaa kustannukset.
Murheissaan tuijotti hän kohden taivasta, josta päivänterä
häikäisevänä säteili häntä vastaan.

"Ah", huusi hän, "voisinpa edes tuon auringon siepata taivaalta!


Heti tahtoisin sen myydä kilveksi parturi pahaselle, sillä hänen
entisensä onkin jo kurjan risainen. — Mitä tehdä? — Niin, mitä
tehdä? Saanhan kysyä, mutta kukapa minulle vastaisi! Minä
näännyn! — Sata dukaattia antaisin kunnollisesta viinikulauksesta tai
paremmin sanoen: en antaisi yhtä kulausta sadasta kultakolikosta.
— Jospa tietäisin suonissani virtaavan viiniä veren sijasta, avaisin ne
kahdestatoista kohden ja virkistäisin kurkkuani, viisi siitä, vaikka
silloin päättäisinkin päiväni. — — Ah, miksei minua ole luotu
viinitynnyriksi, tuollaiseksi kauniiksi, täpötäydeksi, sadan ämpärin
vetoiseksi viinitynnyriksi! Laupias vapahtaja, olisin jo tyytyväinen,
vaikkapa olisin edes kannunpullo; tai olisinpa vain tuollainen
savilautanenkaan, joka vetelehtii tynnyrin tapin alla! No, olisipa se
kylläkin alhainen asema! — Mutta yhdellä ehdolla: pian — heti
täytyisi sen tapahtua!"

Niin kuului herra Daniel Csigolyan surumielinen yksinpuhelu.


Hänen toiveensa muuttua viiniastiaksi, oli pettävä, hän pysyi sinä,
mikä oli, ainoastaan hänen janonsa tuli yhä tuntuvammaksi. — Hän
antoi katseensa, joka oli pelkkää toivoa ja epätoivoa, harhailla
yltympäri, eikö mistään keksisi mitään, mikä kelpaisi kapakassa
maksuksi tai pantiksi.

Ei mitään, ei kerrassaan mitään!

Huolellisesti penkoi hän kaikki taskunsa, vaikkakin hän tiesi, että


ne jo aikoja sitten olivat olleet vain tyhjää täytenään. Kentiesi olisi
sittenkin johonkin sopukkaan kätkeytynyt jokin kokoonrypistynyt
seteliraha.

Masentunein mielin antoi hän turhan etsinnän perästä käsiensä


vaipua.

Äkkiä juolahti hänen mieleensä aatos. Hän pani kätensä otsaansa


vasten ja napsutteli sormillaan.

"Nytpä tiedän! — Tänne lukko ovesta! Se on sitäpaitsi tarpeeton


siellä, missä ei ole mitään varastamista. — Daniel Csigolya, sinä olet
sentään kekseliäs mies!"

Hän etsi kirvestä toteuttaakseen aikomuksensa; hän unhotti aivan,


että tämä työkalu oli jo aikoja juotu. Hän etsi ja etsi, vieläpä
pöytälaatikostakin; vihdoin ryömi hän myös vuoteen alla. Siellä
pimeässä sinne tänne haparoidessaan, sattui hänen käteensä
pikkumytty, joka oli kätketty kaukaisempaan nurkkaan; hän veti sen
esille, katseli sitä kynttilänvalossa ja huudahti riemastuneena:

"Nyt en tarvitse lukkoa, se voi jäädä vastaiseksi, täksi päivää riittää


tämäkin! — Vaimoni juttelee naapurissa, voin sen siis häiritsemättä
viedä. Jos hän huomaa sen myöhemmin, niin kylläpähän hänestä
aina selvitään! — Muuten ei hän tarvitse tätä rääsyä enää. — — Ja
nyt: tule veli Dan!"
Pahaksi onneksi astui, juuri kun hän tarttui säppiin, hänen
vaimonsa tupaan.

"Minne sen kerällä?" kysyi hän hämmästyneenä.

"Ulos, hiukan tuulettamaan, vaimoseni. Vuoteen alla on liian


kosteaa, sehän voisi siellä kokonaan mädätä."

"Tuulettamaan! — Niin! — Kenties! kapakkaan! — Siitä ei tule


mitään, heti vaan tänne se! Se ei saa mennä toisten tietä. Siinä
astuin minä alttarin ääreen, siinä tahdon myös astua Jumalan eteen,
se oli morsiuspukuni ja pitää olla myös kuolinverhonani. — Oi! etten
tiennyt sitä paremmin kätkeä, sillä enhän olisi voinut ajatellakaan,
että nuuskit kaikki, sinä onneton!"

"Jos tahdot nähdä minut onnellisena, niin laita tie vapaaksi."

"Mene, mikäs estää, mutta pukuni jää tänne."

"Kiitos kaunis!"

"Kokonaisena ei se lähde käsistäni!"

"Vaimo! Tiedät, että saan sinua käskeä, koska olen sinun herrasi.
Mutta minä en käske, minä pyydän: Anna minulle puku! Pyydän
sinulta, rakas, hyvä Sofie."

"En!"

"Vielä kerran pyydän sitä sinulta."

"En, en!"

"Ja viimeisen kerran pyydän minä".


Vaimo ei antanut mitään vastausta, vaan tarttui yhä lujemmin
myttyyn, jonka hän oli temmannut mieheltään.

"Vihoviimeisen kerran, Sofie!"

"Turhaan!"

"Koska kaikki on turhaa: Tuoss' on!"

Samalla löi hän vaimoraukkaa vasten kasvoja, niin että tämä


kaatui takaperin. Mies sieppasi pudonneen mytyn ja kiiruhti
kapakkaan.

Silloinkos riemu alkoi!

Viini virtaili kuin olisi hän saanut sen ilmaiseksi. Herra Daniel
päätti, ettei hän ennen nouse pöydästä, ennenkuin on juonut koko
morsiusleningin hinnan suuhunsa.

Mies piti sanansa!

Kun taskut ja pullot olivat tyhjentyneet, toikkaroi hän laulaen kotia


kohden. Tiellä alkoi hän tanssia, mutta ryhtyi siihen pahimmalla
paikalla, suuren lammikon rannalla, jossa sikojen oli tapana rypeä.
Tanssinpyörteessä kadotti hän pian vaivalla pitämänsä tasapainon,
hän putosi syvänteeseen, ja kun yövahti hänet huomasi ja veti ylös,
oli hän jo lammikossa tukehtunut.

Vartija laahasi ruumiin asuntoon, missä vaimo oli tunti sitte antanut
elämän lapselle.

Pimeässä tuvassa oli nyt kolme: kuollut isä, pikku poika, jonka
elämä oli juuri alkanut ja äiti, joka horjui elämän ja kuoleman välillä…
Leski hautautti miehensä ja kastatti lapsen. Hänet nimitettiin
Martiksi. Tästä menevä maksu papille oli aivan hyödytön menoerä,
sillä elämän keväässä eivät toiset lapset kuitenkaan nimittäneet
poikaa muuksi kuin "punaiseksi koiraksi", ja myöhemmin, kun hän
vanheni, tunnettiin hänet vain nimeltä "Papurikko". — Jokainen
lyönti, jonka hänen äitinsä ennen pojan syntymistä oli tämän isältä
saanut, oli merkittyinä hänen kasvoihinsa, joiden oikea puoli oli
hehkuvalla punalla peitetty.

"Mene sinne missä on — Papurikko!" —

"Kammoan häntä kuin — Papurikkoa!" —

"Välitän hänestä yhtä vähän kuin — Papurikosta!" —

"Suutelonko tahdot? — Suutele — Papurikkoa!" —

"Ja niin edelleen! Ja niin edelleen! — Papurikko!" —

Se oli puheenpartena kylässä, kaiken epämieluisen


ilmaisumuotona…

Monen ihmisen elämän täyttää tuska ja kurjuus. Mutta jokaisella


on kuitenkin aika, lapsuuden päivät, jotka ovat onnelliset, riemun
päivät, joiden muistoihin ajatus palaa niin mielellään kuin pääskyset
syksyn kolkkoina päivinä aurinkoiseen etelään.

Martilla ei ollut tätäkään aikaa; hänen lapsuuttaan ei mikään


valokohta kirkastanut enempää kuin myöhempiäkään päiviä. Pojat
eivät tahtoneet leikkiä hänen kanssaan, he antoivat hänen joko
seistä syrjässä tahi ajoivat pois; silloin oli hänen tapana juosta kotiin
itkien äidilleen välittääkseen, kuinka hän oli kaikkien tiellä. Ja äiti
puristi hänet sydäntään vasten ja itki hänen kerallaan…
Kouluvuosina oli vielä tuskaisempaa.

Kukaan ei tahtonut ottaa "punaista koiraa" naapurikseen ja kun


opettaja hänelle vihdoin määräsi paikan, kiusasivat ja pilkkasivat
pojat häntä niin, että hän sen mielellään jätti; hän sai paikkansa
viimeisimmässä penkissä ja etäisimmässä nurkassa. Kun joku
häiritsi opetuksen rauhaa jutellen tahi vinkasten ja opettaja vihaisena
etsi syyllistä, niin osotettiin Marttia aina yksimielisesti pahantekijäksi;
se oli aika riemu, kun hän sitten viattomana kärsi kipeän kurituksen,
joka häntä kuitenkin vähemmän piinasi kuin selkäsaunat ja
herjaukset, joita hän sai tovereiltaan…

Miehensä kuoleman jälkeen vetäytyi rouva Csigolya omaisuutensa


vähäpätöisten jäännösten kanssa veljensä, kylänsepän luo, joka oli
vanhapoika; ystävällisesti otti hän vastaan nuoremman sisarensa ja
tämän pojan. — Kukaan ei tiennyt, miksi hyvinvoipa mestariseppä oli
jäänyt naimattomaksi; juorukellot tosin kertoivat, ettei kukaan tyttö
tahtonut ottaa häntä, mutta se oli vaan tyhjää puhetta, sillä ei ollut
ainoatakaan todistusta siitä, milloin hän olisi oikeastaan koettanut
kosia…

*****

Martti oli kahdentoista vanha, kun hänen enonsa sanoi hänen


äidilleen: "Sisar Sofia, kuinka pojan tulee nyt käymään? Tuleeko
hänestä renki vai ajuri?"

"Sitä en voi sanoa", vastasi rouva. "Hänen isänsä oli


käsityöläinen" samalla huokasi hän — "voisi kai hänestäkin se tulla."

"Sitä minäkin luulen ja siksi tahdoinkin asiasta puhella kanssasi.


Olisi kai parhainta, että opettaisin hänelle ammattini; kun
myöhemmin erkanen työstä tahi kun kuolen, voi hän ottaa pajan
haltuunsa. Poika parka! En rakasta häntä liioin, mutta säälin häntä ja
siksi tahdon hankkia hänelle toimeentulon, ettei hän olisi
tulevaisuudessa määrätty ihmisten armoille, sillä siinä tapauksessa
täytyisi hänen kuolla nälkään. Muuten onkin hän työhön sopiva,
ponteva ja voimakas kuin Herkules. Ja jos häneltä joskus puuttuu
hiiliä, tarvitsee hänen vaan asettaa rauta poskelleen, niin se tulee
hehkuvaksi. Hahaha!" —

"Hannu", sanoi rouva alakuloisena, "miksi teet sinäkin pilkkaa


raukasta. Eikö siinä ole kylliksi, että hän on koko kylän
pilkkatauluna!"

"No, no! Pieni pila ei lyönyt läpeä pääkoppaan!"

Mestari Hannukin kuului niihin, jotka hyväntekeväisyydestään


mielellään kantavat pienen koron, joka vähentää lahjan arvoa…

Seuraavana päivänä erkani Martti koulusta, mikä oli hänestä


mieluista. Kirjojen sijaan otti hän vasaran käteensä, sillä mitäpä
hyödyttikään turha päänvaiva. Eihän hänestä olisi kumminkaan tullut
pappia, vaikkapa olisikin istunut kirjojen ääressä päivät päästään.

Nyt vasta huomasi hän, mikä voima piili hänen jäsenissään.

"Hei! Olisinpa tiennyt ennemmin, kuinka vahva olen", puheli hän


itsekseen, "niin olisin hankkinut jo aikoja rauhan itselleni!" Ja
vihaisena löi hän rautaa kuin olisi se ollut hänen tuskiinsa syypää…

Kylän lapset rakastivat pajoja! Tuntikausia vetelehtivät he siellä,


ilokseen kuunnellen palkeen pauhinaa ja vasaran kalsketta ja
katsellen hehkuvaa rautaa, jonka kipenet joka lyönnillä täyttivät
ilman, ikäänkuin metalli olisi suuttunut kovan painon tähden. —
Mestari Hannun pajalle eivät pojat tulleet ainoastaan uteliaisuudesta,
mutta melkein yksinomaan pilkatakseen ja haukkuakseen Marttia. —

"Pojat, katsokaas, kuinka musta ja likainen hän on; punaisesta


koirasta on tullut musta piru!" huusi joku joukosta.

"Nyt on hän kauniimpi kuin ennen!" pilkkasi toinen.

"Mutta noki ei peitä hyvin. Mustan alta paistaa punainen


irvinaama!"

"Menkää tiehenne, tai viivyttelijä voi katua!" huusi Martti.

Mutta pojat nauroivat ja menivät ilkeydessään yhä pitemmälle,


kunnes Martti kadotti kärsivällisyytensä. Kädessään kanki, jota hän
Juuri takoi, syöksyi hän vintiöiden joukkoon ja alkoi huimia, jotta he
epäilemättä olisivat menneet mäsäksi, jolleivät olisi olleet
lujempitekoisia kuin muutaman pojan jalka, jonka hän löi poikki; hän
liikkaa vielä tänäkin päivänä…

Pitkiin aikoihin ei kukaan uskaltanut lähestyä pajaa, jokainen


pelkäsi hänen tanakoita jäseniään; kuukauden perästä oli löylytys
kuitenkin unohtunut ja pilkkasanat satelivat taas.

Martti kiskotti särkynyttä vaununreunaa, kun lurjukset taas


saapuivat ja räkyttivät pahemmin kuin koskaan.

"Hiljaa!" tiuskasi hän huimapäille.

Ivanauru oli vastaus! — Yhä karvaammiksi kävivät pistopuheet,


kunnes Martti, riehuen raivoissaan, heitti hehkuvan raudan erään
pojan kasvoihin. Kauhistuneena hajaantui poikasakki.
"Mene!" huusi Martti, "mene, kanna sinäkin Jumalanmerkkiäsi! —
Ja jos eksyt, löydetään sinut kyllä polttomerkistäsi!"…

Tämä tapaus saattoi Martille paljon pahaa, mutta myöskin hyvää,


sillä yksikään pojista ei uskaltanut häntä enää pilkata…

Kuusi vuotta kului; jokainen karttoi Marttia ja hän jokaista!

Työpäivinä oli hän työssään ja juhlahetkinä sekä lepopäivinä pysyi


hän kotona. Ainoastaan sunnuntaisin meni hän kirkkoon, kumminkin
siihen aikaan, jolloin kaikki kyläläiset olivat jo menneet sisään; hän
asettui pimeään nurkkaan, oven viereen, ja kun pappi oli lausunut
aamenen, kiiruhti hän ulos ja oli jo kotona, kun toiset vasta lähtivät
kirkosta. Iltapäivin, kun oppipojat huvittelivat kirkkoniityllä pallosilla
tai muilla leikeillä, istui hän äitinsä luona tupasessa ja luki hänelle
raamattua. Tämä lukeminen ei tosin häntä suuresti huvittanut, mutta
hän kärsi mielellään ikävääkin, kun siten voi hankkia äidilleen iloa,
hänelle, joka häntä niin hellästi rakasti, ja oli ainoa kaikkien
joukossa, joka ei koskaan ollut lausunut hänelle pahaa sanaa…

Myöskin Martin kuusi oppivuotta kuluivat, hän suoritti


opinnäytteensä ja — oli kisälli!

Tärkeä käännekohta käsityöläiselämässä!

Suurempi on oppilaan riemu, suurempi hänen ylpeytensä sälliksi


päästessään kuin sällin, suoritettuaan mestarinäytteensä ja
päästyään mestariksi. Martti Csigolyakin tunsi tätä onnea. "Nyt on
minusta kumminkin tullut toinen mies", ajatteli hän. "En ole enää
poika, vaan nuorukainen, en renki, vaan vapaa kisälli. Kun nyt
saavun ihmisten luo, ei kai kukaan uskalla tehdä sitä, mitä he ovat
tehneet hyljätylle, avuttomalle pojalle. Niin — tuskinpa he tuota

You might also like