Curs de Programare Java

Embed Size (px)

DESCRIPTION

Curs pentru programare Java. Cuprinde sintaxa, clase, obiecte, exemple de coduri.

Citation preview

  • 5/25/2018 Curs de Programare Java

    1/200

    Java Programming/Print version

    Wikibooks.org

  • 5/25/2018 Curs de Programare Java

    2/200

    February 15, 2012

  • 5/25/2018 Curs de Programare Java

    3/200

    Contents

    1 INTRODUCTION 3

    1.1 A RE YOU NEW TO PROGRAMMING? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 PROGRAMMING WITHJAVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    2 ABOUTTHI SBOO K 5

    2.1 W HO SHOULD READ THIS BOOK? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 HOW CAN YOU PARTICIPATE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 NECESSARY PREREQUISITES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    3 HISTORY 133.1 THEGREEN TEAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.2 RESHAPING THOUGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.3 THE DEMISE OF AN IDEA,BIRTH OF ANOTHER . . . . . . . . . . . . . . . . . . . . . 173.4 RECENT HISTORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.5 V ERSIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.6 CITATIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    4 THE JAVAPLATFORM 21

    4.1 JAVARUNTIMEENVIRONMENT( JRE) . . . . . . . . . . . . . . . . . . . . . . . . . . 214.2 JAVADEVELOPMENTKIT ( JDK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    4.3 SIMILAR CONCEPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 GETTINGSTARTED 33

    5.1 GETTINGSTARTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    6 COMPILATION 35

    6.1 COMPILING TO BYTECODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356.2 A UTOMATICCOMPILATION OFDEPENDENTCLASSES . . . . . . . . . . . . . . . . . 366.3 PACKAGE S, SUBDIRECTORIES,A ND RESOURCES . . . . . . . . . . . . . . . . . . . . 366.4 FILENAMECAS E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376.5 COMPILEROPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376.6 A DDITIONALTOOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    6.7 JBUILDER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386.8 JCREATOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386.9 ECLIPSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386.10 NET BEANS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.11 BLUEJ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.12 K AWA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396.13 A NT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406.14 THEJIT COMPILER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

    III

  • 5/25/2018 Curs de Programare Java

    4/200

    Contents

    7 EXE CU TI ON 43

    7.1 JSECODE EXECUTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437.2 J2EECODE EXECUTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467.3 JIN I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    8 UNDERSTANDING AJAVAPROGRAM 51

    8.1 THE D ISTANCECLASS: INTENT, S OURCE,A ND USE . . . . . . . . . . . . . . . . . . 518.2 DETAILEDPROGRAMSTRUCTURE ANDOVE RVIE W . . . . . . . . . . . . . . . . . . . 528.3 COMMENTS INJAVA PROG RA MS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

    9 SYN TAX 61

    9.1 UNICODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629.2 LITERALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639.3 BLOCKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649.4 W HITESPACES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659.5 REQUIREDWHITESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659.6 INDENTATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    10 STATEMENTS 67

    10.1 W HAT EXACTLY ARE STATEMENTS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6710.2 W HERE DO YOU FIND STATEMENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . 6710.3 V AR IA BL ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6710.4 DATA TY PES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6810.5 W HOLE NUMBERS AND FLOATING POINT NUMBERS . . . . . . . . . . . . . . . . . . 6810.6 A SSIGNMENT STATEMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    11 CLASSES, OBJECTS ANDTYP ES 71

    11.1 OBJECTS ANDCLASSES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7111.2 INSTANTIATION ANDCONSTRUCTORS . . . . . . . . . . . . . . . . . . . . . . . . . . 7111.3 TYP E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7211.4 MULTIPLE CLASSES I N AJAVA FIL E . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7311.5 EXT ER NA L LI NKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    12 PAC KA GE S 75

    12.1 JAVAPACKAGE / NAM ESPACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7512.2 W ILDCARD IMPORTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7612.3 IMPORTING PACKAGES FROM. JAR FILES . . . . . . . . . . . . . . . . . . . . . . . . . 7612.4 CLASSLOADING/ NAM ESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    13 NESTEDCLASSES 79

    13.1 NEST A CLASS INSIDE A CLASS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7913.2 NEST A CLASS INSIDE A METHOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8013.3 A NONYMOUSCLASSES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    14 ACCESSM ODIFIERS 83

    14.1 A CCESS MODIFIERS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

    15 METHODS 85

    15.1 METHODDEFINITION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8515.2 METHODOVE RL OADI NG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    IV

  • 5/25/2018 Curs de Programare Java

    5/200

    Contents

    15.3 METHODOVE RR ID IN G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8715.4 PAR AM ET ER PAS SI NG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8815.5 FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8915.6 RETURNPAR AM ET ER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8915.7 SPECIAL METHOD,T HECONSTRUCTOR . . . . . . . . . . . . . . . . . . . . . . . . . 9115.8 STATICMETHODS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9215.9 EXT ER NA L LI NK S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    16 PRIMITIVETYP ES 95

    17 TYP ES 97

    17.1 DATATYP ES INJAVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9717.2 JAVA AS HY BR ID LA NG UAG E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9817.3 EXA MP LE S OF TYP ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9817.4 A RRAYTYP ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9917.5 PRIMITIVEDATATYP ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10017.6 DATACONVERSION(CAS TI NG ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

    17.7 A UTOBOXING/UNBOXING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

    18 JAVA.LANG.S TRING 103

    18.1 JAVA.LANG.S TRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10318.2 USINGSTRINGBUFFER/S TRINGBUILDER TO CONCATENATE STRINGS . . . . . . . . 10418.3 COMPARINGSTRINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10518.4 SPLITTING ASTRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10618.5 CREATING SUBSTRINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10718.6 MODIFYINGSTRING CASES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10718.7 SEE ALSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    19 ARRAYS 109

    19.1 INTRO TOARRAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10919.2 A RRAYFUNDAMENTALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10919.3 TWO-D IMENSIONALARRAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11019.4 MULTIDIMENSIONAL ARRAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

    20 DATA AN DVAR IA BL ES 113

    20.1 STRONGTYP IN G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11420.2 CAS ECONVENTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11420.3 SCOPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

    21 GENERICS 117

    21.1 W HAT AREGENERICS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11721.2 INTRODUCTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11821.3 NOTE FORC++ PROGRAMMERS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11921.4 CLASS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12021.5 V AR IA BL EARGUMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12121.6 W ILDCARDTYP ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    22 DEFININGCLASSES 125

    22.1 FUNDAMENTALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

    V

  • 5/25/2018 Curs de Programare Java

    6/200

    Contents

    23 CREATINGOBJECTS 129

    23.1 INTRODUCTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12923.2 CREATING OBJECT WITH THEnewKEYWORD . . . . . . . . . . . . . . . . . . . . . . 12923.3 CREATING OBJECT BY CLONING AN OBJECT . . . . . . . . . . . . . . . . . . . . . . . 13023.4 CREATING OBJECT RECEIVING FROM A REMOTE SOURCE . . . . . . . . . . . . . . . 132

    24 INTERFACES 13524.1 INTERFACES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13524.2 EXT ER NA L LI NKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    25 USINGSTATICMEMBERS 137

    25.1 W HAT DOES STATIC MEAN? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13725.2 W HAT CAN IT BE USED FOR? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13725.3 DAN GE R OF STATIC VAR IA BL ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13825.4 EXT ER NA L LI NKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

    26 DESTROYINGOBJECTS 139

    26.1 FINALIZE

    () . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13927 OVE RL OADI NG METHODS ANDCONSTRUCTORS 141

    28 ARRAYS 143

    28.1 INTRO TOARRAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14328.2 A RRAYFUNDAMENTALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14328.3 TWO-D IMENSIONALARRAYS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14428.4 MULTIDIMENSIONAL ARRAY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    29 COLLECTIONCLASSES 147

    29.1 INTRODUCTION TOCOLLECTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    29.2 GENERICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14829.3 COLLECTION ORMAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14929.4 SET ORL IST ORQUEUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15129.5 MAP CLASSES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15829.6 THREADSAF ECOLLECTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15929.7 CLASSESD IAGRAM(UML) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15929.8 EXT ER NA L LI NKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

    30 THROWING ANDCATC HI NG EXC EP TI ON S 163

    30.1 EXCEP TI ON ARGU MENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16430.2 CATCHI NG AN EXCE PTIO N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16530.3 EXCEP TI ON HA ND LE RS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16530.4 EXCEP TI ON CL AS SE S IN TH EJCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16630.5 CATCH CL AUS ES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16830.6 EXA MP LE OF HA ND LI NG EXCEPT IO NS . . . . . . . . . . . . . . . . . . . . . . . . . . 16930.7 A PPLICATIONEXCEP TI ON S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17030.8 RUNTIMEEXCEP TI ON S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17130.9 K EYWORD REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17230.10 MINIMIZE THE USE OF THE KEYWORD NULL IN ASSIGNMENT STATEMENTS . . . . 17330.11 MINIMIZE THE USE OF THE NEWTYP E[IN T]SYNTAX FOR CREATING ARRAYS OF OB-

    JECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    VI

  • 5/25/2018 Curs de Programare Java

    7/200

    Contents

    30.12 CHECK ALL REFERENCES OBTAINED FROMUNTRUSTEDMETHODS . . . . . . . . . 17430.13 COMPARING STRING VARIABLE WITH A STRING LITERAL . . . . . . . . . . . . . . . . 17430.14 SEE ALSO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    31 LINKS 177

    31.1 EXT ER NA LREFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    31.2 EXT ER NA L LI NK S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    32 LICENSE 181

    33 GNU FRE ED OCUMENTATION L ICENSE 183

    34 AUTHORS 185

    LIST OFF IGURES 193

    1

  • 5/25/2018 Curs de Programare Java

    8/200

    Contents

    2

  • 5/25/2018 Curs de Programare Java

    9/200

    1 Introduction

    The beautiful thing about learning is nobody can take it away from you

    Learning a computer programming language is AKIN TO1 a toddlers first few steps towards anupright walk. You stumble and you fall but when you start walking, you take upon it as SECONDNATURE2. Learning to program is similar in many ways to learning to walk. However once youstart programming, you never cease to evolve. Learn one programming language and you knowthem all.

    This book is a concentrated effort in trying to get you to take your baby steps towards program-ming in the Java programming language. Although this book is primarily meant to act as alearning aid for beginners, it can equally be helpful as a reference manual and guide for the in-termediate and experienced programmers. The book is laid out in such a manner that with eachsuccessive chapter, the complexity of programming constructs increase. Thus, programmers areconstantly challenged to develop their skills with a progressive learning curve.

    1.1 Are you new to programming?

    Figure 1: This stunning image of the sunset on planet Mars wouldnthave been possible without Java.

    If you have chosen Java as your first programming language, be assured that Java happens toalso be the first choice for educational programs in many universities and colleges. Its simpleand intuitiveSYNTAX3 (thats grammar for programming languages) helps beginners feel at easewith complex programming constructs in no time.

    But be aware, Java is not just anybasicprogramming language. In fact, NASA used Java as thedriving force (quite literally) behind its Mars Rover missions. Computers, mobile phones, set-top boxes, and even digital television sets can all be programmed using the Java programming

    1 HTTP://EN.WIKTIONARY.ORG/WIKI/AKIN2 HTTP://EN.WIKTIONARY.ORG/WIKI/SECOND%20NATURE3 HTTP://EN.WIKTIONARY.ORG/WIKI/SYNTAX

    3

    http://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/akinhttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/syntaxhttp://en.wiktionary.org/wiki/second%20naturehttp://en.wiktionary.org/wiki/akin
  • 5/25/2018 Curs de Programare Java

    10/200

    Introduction

    language. Robots, air traffic control systems and the self-checkout barcode scanners in yourfavourite supermarkets are all being programmed in Java.

    1.2 Programming with Java

    By now, you might truly be able to grasp the power of the Java programming language there isstill lots more youcan do with Java. Not every programmer gets to program applications that takeunmanned vehicles onto other planets. Software that we encounter in our daily life is somewhathumble in that respect. Software programs and applications written in Java however cover vastarea of the computing ecosphere. Here are just some examples of the ubiquitous nature of Javaapplications in real-life:

    OPE NOFFICE.ORG4, a desktop office management suite that rivals the Microsoft Office suitehas been written in Java.

    The popular building game MINECRAFT5 is also written in Java. Online browser-based games like RUNESCAPE6, a 3D massively multi-player online role playing

    game (MMORPG), run on graphics routines, 3D rendering and networking capabilities pow-ered by the Java programming language.

    Two of the worlds renowned digital video recorders, TIVO7 and BSkyBs SKY+8 use built-in livetelevision recording software to record, rewind and play your favourite television shows. Theseapplications make extensive use of the Java programming language.

    The above mentioned application illustrates the reach and ubiquity of Java applications. Heresanother fact almost 80% of mobile phone vendors adopt Java as their primary platform for thedevelopment of applications. The second mostwidely used mobile-based operating system, AN-DROID9, uses Java as one of its key application platforms developers are encouraged to developapplication for Android in the Java programming language.

    1.2.1 What can Javanotdo?

    Well, to be honest, there is nothing that Java can not do. You can program just about anything inJava. This book would however get you acquainted with the basics of the language in order foryou to create that masterpiece of a software you dream of creating one day.

    People have written operating systems in Java, they have programmed robots in the languageand managed power stations and conveyor belts in factories; thus, you can do anything andeverything with Java. Your applications and code need not fear any bounds because with Java,possibilities are endless all you need iscreativity.

    4 HTTP://EN.WIKIPEDIA.ORG/WIKI/OPENOFFICE.ORG5 HTTP://EN.WIKIPEDIA.ORG/WIKI/MINECRAFT6 HTTP://EN.WIKIPEDIA.ORG/WIKI/RUNESCAPE7 HTTP://EN.WIKIPEDIA.ORG/WIKI/TIVO8 HTTP://EN.WIKIPEDIA.ORG/WIKI/SKY%2B9 HTTP://EN.WIKIPEDIA.ORG/WIKI/ANDROID%20%28OPERATING%20SYSTEM%29

    4

    http://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/OpenOffice.orghttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Android%20%28operating%20system%29http://en.wikipedia.org/wiki/Sky%2Bhttp://en.wikipedia.org/wiki/TiVohttp://en.wikipedia.org/wiki/Runescapehttp://en.wikipedia.org/wiki/Minecrafthttp://en.wikipedia.org/wiki/OpenOffice.org
  • 5/25/2018 Curs de Programare Java

    11/200

    2 About This Book

    The Java ProgrammingWikibook is a shared effort in amassing a comprehensive guide of thecomplete Java platform - from programming advice and tutorials for the desktop computer toprogramming on mobile phones. The information presented in this book has been concep-tualised with the combined efforts of various AUTHORS AND CONTRIBUTORS1, and anonymouseditors.

    The primary purpose of this book is to teach the Java programming language to an audience ofbeginners, but its progressive layout of tutorials increasing in complexity, it can be just as helpfulfor intermediate and experienced programmers. Thus, this book is meant to be used as:

    a collection of tutorials building upon one another in a progressive manner; a guidebook for efficient programming with the Java programming language; and, a comprehensive manual resource for the advanced programmer.

    This book is intended to be used in conjunction with various other online resources, such as:

    the JAVA PL ATF OR MAPI DOCUMENTATION2; the OFFICIALJAVA WE BSIT E3; and, active Java communities online, such as JAVA.NE T4 and JAVARAN CH5, etc.

    2.1 Who should read this book?

    Every thing you would need to know to write computer programs would be explained in thisbook. By the time you finish reading, you will find yourself proficient enough to tackle just aboutanything in Java and programs written using it. This book serves as the first few stepping stonesof many you would need to cross the unfriendly waters of computer programming. We have puta lot of emphasis in structuring this book in a way that lets you start programming from scratch,with Java as your preferred language of choice. This book is designed for you if any one of thefollowing is true.

    You are relatively new to programming and have heard how easy it is to learn Java. You had some BASIC6 or PAS CA L7 in school, and have a grasp of basic programming and logic.

    You already know and have been introduced to programming in earlier versions of Java.

    1 HTTP://EN.WIKIBOOKS.ORG/WIKI/JAVA%20PROGRAMMING%2FAUTHORS%20%26%20CONTRIBUTORS

    2 HTTP://DOWNLOAD.ORACLE.COM/JAVASE/7/DOCS/API/OVERVIEW-SUMMARY.HTML3 HTTP://WWW.ORACLE.COM/US/TECHNOLOGIES/JAVA/INDEX.HTML4 HTTP://HOME.JAVA.NET5 HTTP://WWW.JAVARANCH.COM6 HTTP://EN.WIKIPEDIA.ORG/WIKI/BASIC7 HTTP://EN.WIKIPEDIA.ORG/WIKI/PASCAL%20%28PROGRAMMING%20LANGUAGE%29

    5

    http://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://www.oracle.com/us/technologies/java/index.htmlhttp://home.java.net/http://home.java.net/http://home.java.net/http://home.java.net/http://home.java.net/http://home.java.net/http://home.java.net/http://www.javaranch.com/http://www.javaranch.com/http://www.javaranch.com/http://www.javaranch.com/http://www.javaranch.com/http://www.javaranch.com/http://www.javaranch.com/http://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/BASIChttp://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/Pascal%20%28programming%20language%29http://en.wikipedia.org/wiki/BASIChttp://www.javaranch.com/http://home.java.net/http://www.oracle.com/us/technologies/java/index.htmlhttp://download.oracle.com/javase/7/docs/api/overview-summary.htmlhttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Java%20Programming%2FAuthors%20%26%20Contributors
  • 5/25/2018 Curs de Programare Java

    12/200

    About This Book

    You are an experienced developer and know how to program in other languages like C+ +8,VISUALBAS IC9, PYT HO N10 or RUB Y11.

    Youve heard that Java is great for web applications and web services programming.

    Although, this book is generally meant to be for programmers who are beginning to learn pro-gramming; it can be highly beneficial for intermediate and advanced programmers who may

    have missed up on some vital information. By the end of this book, you would be able to solveany complicated problem and tackle it using the best of your learnt skills in Java. Once you fin-ish, you are also encouraged to take upon ambitious programming projects of your own as youcertainly would be able to do that as well.

    This book assumes that the reader has no prior knowledge of programming in Java, or for thatmatter, any object-oriented programming language. The book makes it easier to understanddevelopment methodology as one reads through the book with practical examples and exercisesat the end of each topic and module. Although, if you are a complete beginner, we would suggestthat you move slowly through this book and practice each exercise at your pace.

    2.2 How can you participate

    Content is constantly being updated and enhanced in this book as is the nature of wiki-basedcontent. This book is therefore in a constant state of evolution. Any Wikibooks users can partic-ipate in helping this book to a better standard as both a reader, or an author/contributor.

    2.2.1 As a reader

    If you are interested in reading the content present in this book, we encourage you to:

    share comments about the technical accuracy, content, or organisation of this book by tellingthe authors in theDiscussionsection for each page. You can find the linkDiscussionon eachpage in this book leading you to appropriate sections for discussion.

    leave a signature when providing feedback, writing comments, or giving suggestion on theDiscussionpages. This can be achieved by appending -- to your messages. Donotaddyour signatures to theBookpages, they are only meant for the Discussionpages.

    review pages at the bottom of every page of this book, you are likely to find controls that helpyou review and give feedback for pages. Content on each page should be rated according tothe four Wikibooks quality metrics: Reliability,Completeness,NeutralityandPresentation.

    share news about the Java Programming Wikibook with your family and friends and let themknow about this comprehensive Java guide online.

    become a contributing author, if you think that you have information that could fill in somemissing gaps in this book.

    8 HTTP://EN.WIKIPEDIA.ORG/WIKI/C%2B%2B9 HTTP://EN.WIKIPEDIA.ORG/WIKI/VISUAL%20BASIC10 HTTP://EN.WIKIPEDIA.ORG/WIKI/PYTHON%20%28PROGRAMMING%20LANGUAGE%2911 HTTP://EN.WIKIPEDIA.ORG/WIKI/RUBY%20%28PROGRAMMING%20LANGUAGE%29

    6

    http://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/C%2B%2Bhttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Ruby%20%28programming%20language%29http://en.wikipedia.org/wiki/Python%20%28programming%20language%29http://en.wikipedia.org/wiki/Visual%20Basichttp://en.wikipedia.org/wiki/C%2B%2B
  • 5/25/2018 Curs de Programare Java

    13/200

    Necessary prerequisites

    2.2.2 As an author or contributor

    If you intent on writing content for this book, you need to do the following:

    When writing content for this book, you can always pose as an anonymous author, howeverwe recommend you sign-in into the Wikibooks website when doing so. It becomes easier to

    track and acknowledge changes to certain parts parts of the book. Furthermore, the opinionsand views of logged-in users are given precedence over anonymous users.

    Once you have started contributing content for this book, make sure that you add your nametoTHE AUTHORS AND CONTRIBUTORS LIST12.

    BE BOLD13 and try to follow the CONVENTIONS14 for this Wikibook. It is important that theconventions for this book be followed to the letter to make content consistent and reliablethroughout.

    2.3 Necessary prerequisites

    2.3.1 Installing the Java platform

    For in-depth information, see the chapter onTHEJAVA PL ATF OR M15.

    In order to make use of the content in this book, you would need to follow along each and everytutorial rather than simply reading through the book. But to do so, you would need access to acomputer with theJava platforminstalled on it the Java platform is the basic prerequisite forrunninganddevelopingJava code, thus it is divided into two essential software:

    theJava Runtime Environment (JRE), which is needed torunJava applications and applets;

    and, theJava Development Kit (JDK), which is needed todevelopthose Java applications and ap-

    plets.

    However as a developer, you would only require the JDK which comes equipped with a JRE aswell. Given below are installation instruction for the JDK for various operating systems:

    2.3.2 For Windows

    Download instructions

    Some Windows based systems come built-in with the JRE, however for the purposes of writingJava code by following the tutorials in this book, you would require the JDK nevertheless. Toacquire the latest JDK (version 7), you can manually DOWNLOAD THEJAVA SO FT WAR E16 from theOracle website.

    12 HTTP://EN.WIKIBOOKS.ORG/WIKI/..%2FAUTHORS%20%26%20CONTRIBUTORS13 HTTP://EN.WIKIBOOKS.ORG/WIKI/BE%20BOLD14 HTTP://EN.WIKIBOOKS.ORG/WIKI/..%2FCONVENTIONS15 Chapter4on page2116 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASE/DOWNLOADS/INDEX.HTML

    7

    http://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributorshttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/..%2FConventionshttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://en.wikibooks.org/wiki/..%2FConventionshttp://en.wikibooks.org/wiki/Be%20Boldhttp://en.wikibooks.org/wiki/..%2FAuthors%20%26%20Contributors
  • 5/25/2018 Curs de Programare Java

    14/200

    About This Book

    For the convenience of our readers, the following table presents direct links to the latest JDK forthe Windows operating system.

    Operating system Setup Installer LicenseWindows x86 DOWNLOAD17 ORACLEB INARYCOD EL I-

    CENSEAGREEMENT18

    Windows x64 DOWNLOAD19 ORACLEB INARYCOD EL I-CENSEAGREEMENT20

    You must follow the instructions for the setup installer wizard step-by-step with the default set-tings to ensure that Java is properly installed on your system. Once the setup is completed, it ishighly recommended to restart your Windows operating system.

    If you kept the default settings for the setup installer wizard, you JDK should now be installed atC:\Program Files\Java\jdk1.7.0_01. You would require the location to yourbinfolder at a latertime this is located atC:\Program Files\Java\jdk1.7.0_01\bin

    Updating environment variables (Optional)

    In order for you to start using the JDK compiler utility with the Command Prompt, you wouldneed to set the environment variables that points to the bin folder of your recently installed JDK.Follow the steps belowto permanently include your Java platform to your environment variables.

    1. For Windows XP, click StartControl PanelSystem.For Windows 2000, clickStartSettingsControl PanelSystem.

    For Window Vista or Windows 7, clickStartControl PanelSystem and MaintenanceSystem.Alternatively, you can also press Win + Rto open theRundialog. With the dialogopen, type the following command at theprompt:

    rundll32 shell32.dll,Control_RunDLL sysdm.cpl

    2. Navigate to theAdvancedtab on the top,and selectEnvironment Variables...

    3. UnderSystem variables, select the vari-able namedPathand clickEdit...

    17 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-WINDOWS-I586.EXE18 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASEBUSINESS/DOCUMENTATION/

    JAVA-SE-BCL-LICENSE-430205.HTML

    19 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-WINDOWS-X64.EXE20 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASEBUSINESS/DOCUMENTATION/

    JAVA-SE-BCL-LICENSE-430205.HTML

    8

    http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exehttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-x64.exehttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://www.oracle.com/technetwork/java/javasebusiness/documentation/java-se-bcl-license-430205.htmlhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-windows-i586.exe
  • 5/25/2018 Curs de Programare Java

    15/200

    Necessary prerequisites

    4. In theEdit System Variabledialog, gothe theVariable valuefield. This field isa list of directory paths separated by semi-colons (;).

    5. To add a new path, append the location of your JDKbinfolder separated by a semi-colon (;).

    6. Click OKon every opened dialog to savechanges and get past to where you started.

    Start writing code

    Once you have successfully installed the JDK on your system, you are ready to program code inthe Java programming language. However, to write code, you would need a decent text editor.Windows comes with a default text editor by default Notepad. In order to use notepad to writecode in Java, you need to follow the steps below:

    1. Click StartAll ProgramsAccessoriesNotepadto invoke the application.Alternatively, you can also press Win + Rto open theRundialog. With the dialogopen, type the following command at theprompt:

    notepad

    2. Once theNotepadapplication has fired up,you can use the editor to write code for the

    Java programming language.

    The problem with Notepad however is that it does not support developer-friendly features, suchasSYNTAX HIGHLIGHTING21 andCODE COMPLETION22. These features are a vital part of the exer-cise of writing code. Nevertheless, there are a variety of different open-source editors availableas alternatives toNotepadthat support these features.

    For the purposes of the tutorials in this book, the most recommended editoris the Notepad++, a free and open-source fully integrated text editor that sup-ports syntax highlighting and code completion. You need to DOWNLOAD THEL ATEST V ERSION O F NOTEPAD++23 in order to start writing code with the editor.

    21 HTTP://EN.WIKIPEDIA.ORG/WIKI/SYNTAX%20HIGHLIGHTING22 HTTP://EN.WIKIPEDIA.ORG/WIKI/CODE%20COMPLETION23 HTTP://NOTEPAD-PLUS-PLUS.ORG

    9

    http://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Syntax%20highlightinghttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Code%20completionhttp://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://notepad-plus-plus.org/http://en.wikipedia.org/wiki/Code%20completionhttp://en.wikipedia.org/wiki/Syntax%20highlighting
  • 5/25/2018 Curs de Programare Java

    16/200

    About This Book

    Note:

    Amongst others, there are many editors available online that are specifically designed to codeJava applications. Such editors have countless other features that facilitate programming withJava, e.g., DEBUGGINGa and application design interfaces, etc. Text editors that have compre-hensive features and utilities to facilitate programmers are calledIntegrated Development En-

    vironmentsor IDEs. Java programmers often recommend the two most widely used IDEs forJava programming needs these are: NetBeans DOWNLOAD HEREb and READ THE INSTALLATION INSTRUCTIONS HEREc. Eclipse Download 32- BIT HEREd and 64-BIT HEREe. You can READ THE INSTALLATION IN-

    STRUCTIONS HEREf.

    a HTTP://EN.WIKIPEDIA.ORG/WIKI/DEBUGGING

    b HTTP://DOWNLOAD.NETBEANS.ORG/NETBEANS/7.0.1/FINAL/BUNDLES/NETBEANS-7.0.

    1-ML-WINDOWS.EXE

    c HTTP://NETBEANS.ORG/COMMUNITY/RELEASES/70/INSTALL.HTML

    d HTTP://WWW.ECLIPSE.ORG/DOWNLOADS/DOWNLOAD.PHP?FILE=/TECHNOLOGY/EPP/DOWNLOADS/

    RELEASE/INDIGO/SR1/ECLIPSE-JAVA-INDIGO-SR1-WIN32.ZIP&R=1

    e HTTP://WWW.ECLIPSE.ORG/DOWNLOADS/DOWNLOAD.PHP?FILE=/TECHNOLOGY/EPP/DOWNLOADS/

    RELEASE/INDIGO/SR1/ECLIPSE-JAVA-INDIGO-SR1-WIN32-X86_64.ZIP&R=1

    f HTTP://WIKI.ECLIPSE.ORG/ECLIPSE/INSTALLATION

    2.3.3 For Linux

    Installation using Terminal

    Downloading and installing the Java platform on Linux machines (in particular Ubuntu Linux)is very easy and straight-forward. To use the terminal to download and install the Java platform,follow the instructions below.

    1. For Ubuntu, go toApplicationAcces-soriesTerminal.Alternatively, you can press Alt + F2 toopen theRun Applicationwindow. At theprompt, typextermorgnome-terminaltoopen theTerminalwindow.

    2. At the prompt, write the following:

    $ sudo apt-get install openjdk-7-jdk openjdk-7-jre openjdk-7-doc

    3. All Java software should be installed andinstantly available now.

    Download instructions

    Alternatively, you can manually DOWNLOAD THEJAVA SO FT WAR E24 from the Oracle website.

    24 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASE/DOWNLOADS/INDEX.HTML

    10

    http://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugginghttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://netbeans.org/community/releases/70/install.htmlhttp://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://wiki.eclipse.org/Eclipse/Installationhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlhttp://wiki.eclipse.org/Eclipse/Installationhttp://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32-x86_64.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-java-indigo-SR1-win32.zip&r=1http://netbeans.org/community/releases/70/install.htmlhttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://download.netbeans.org/netbeans/7.0.1/final/bundles/netbeans-7.0.1-ml-windows.exehttp://en.wikipedia.org/wiki/Debugging
  • 5/25/2018 Curs de Programare Java

    17/200

    Necessary prerequisites

    For the convenience of our readers, the following table presents direct links to the latest JDK forthe Linux operating system.

    Operating system RPM Tarball LicenseLinux x86 DOWNLOAD25 DOWNLOAD26 ORACLEBINARY

    COD EL ICENSE

    AGREEMENT27Linux x64 DOWNLOAD28 DOWNLOAD29 ORACLEBINARY

    COD EL ICENSEAGREEMENT30

    Start writing code

    The most widely available text editor on Gnome desktops is the Geditapplication, while on theKDE desktops, one can find Kate. However unlike Notepad on Windows, both these editors

    support syntax highlighting and code completion and therefore are sufficient for our purposes.However, if you require a robust and standalone text-editor like the Notepad++ editor on Win-dows, you would require the use of the minimalistic editor loaded with features SciTE. Followthe instructions below if you wish to installSciTE:

    1. For Ubuntu, go toApplicationAcces-soriesTerminal.Alternatively, you can press Alt + F2 toopen theRun Applicationwindow. At theprompt, typextermorgnome-terminaltoopen theTerminalwindow.

    2. At the prompt, write the following:

    $ sudo apt-get install scite

    3. You should now be able to use the Sciteeditor for your programming needs.

    25 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-LINUX-I586.RPM26 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-LINUX-I586.TAR.

    GZ

    27 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASEBUSINESS/DOCUMENTATION/JAVA-SE-BCL-LICENSE-430205.HTML

    28 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-LINUX-X64.RPM29 HTTP://DOWNLOAD.ORACLE.COM/OTN-PUB/JAVA/JDK/7U1-B08/JDK-7U1-LINUX-X64.TAR.GZ30 HTTP://WWW.ORACLE.COM/TECHNETWORK/JAVA/JAVASEBUSINESS/DOCUMENTATION/

    JAVA-SE-BCL-LICENSE-430205.HTML

    11

    http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-i586.tar.gzhttp://download.oracl