THE Java™ Programming Language, Fourth Edition by Ken Arnold, James Gosling, David Holmes

Total Page:16

File Type:pdf, Size:1020Kb

THE Java™ Programming Language, Fourth Edition by Ken Arnold, James Gosling, David Holmes 1 THE Java™ Programming Language, Fourth Edition By Ken Arnold, James Gosling, David Holmes ............................................... Publisher: Addison Wesley Professional Pub Date: August 17, 2005 ISBN: 0-321-34980-6 Pages: 928 Table of Contents | Index Direct from the creators of the Java™ programming language, the completely revised fourth edition of The Java™ Programming Language is an indispensable resource for novice and advanced programmers alike. Developers around the world have used previous editions to quickly gain a deep understanding of the Java programming language, its design goals, and how to use it most effectively in real-world development. Now, Ken Arnold, James Gosling, and David Holmes have updated this classic to reflect the major enhancements in Java™ 2 Standard Edition 5.0 (J2SE™ 5.0). The authors systematically cover most classes in Java's main packages, java.lang.*, java.util, and java.io, presenting in-depth explanations of why these classes work as they do, with informative examples. Several new chapters and major sections have been added, and every chapter has been updated to reflect today's best practices for building robust, efficient, and maintainable Java software. Key changes in this edition include • New chapters on generics, enums, and annotations, the most powerful new language features introduced in J2SE 5.0 • Changes to classes and methods throughout to reflect the addition of generics • Major new sections on assertions and regular expressions • Coverage of all the new language features, from autoboxing and variable argument methods to the enhanced for-loop and covariant return types • Coverage of key new classes, such as Formatter and Scanner The Java™ Programming Language, Fourth Edition, is the definitive tutorial introduction to the Java language and essential libraries and an indispensable reference for all programmers, including those with extensive experience. It brings together insights you can only get from the creators of Java: insights that will help you write software of exceptional quality. THE Java™ Programming Language, Fourth Edition By Ken Arnold, James Gosling, David Holmes ............................................... Publisher: Addison Wesley Professional Pub Date: August 17, 2005 ISBN: 0-321-34980-6 Pages: 928 Table of Contents | Index Copyright 1 2 The Java™ Series Preface About This Book Examples and Documentation Acknowledgments (Fourth Edition) Acknowledgments (Third Edition) Acknowledgments (Second Edition) Acknowledgments (First Edition) Chapter 1. A Quick Tour Section 1.1. Getting Started Section 1.2. Variables Section 1.3. Comments in Code Section 1.4. Named Constants Section 1.5. Unicode Characters Section 1.6. Flow of Control Section 1.7. 2 3 Classes and Objects Section 1.8. Methods and Parameters Section 1.9. Arrays Section 1.10. String Objects Section 1.11. Extending a Class Section 1.12. Interfaces Section 1.13. Generic Types Section 1.14. Exceptions Section 1.15. Annotations Section 1.16. Packages Section 1.17. The Java Platform Section 1.18. Other Topics Briefly Noted Chapter 2. Classes and Objects Section 2.1. 3 4 A Simple Class Section 2.2. Fields Section 2.3. Access Control Section 2.4. Creating Objects Section 2.5. Construction and Initialization Section 2.6. Methods Section 2.7. this Section 2.8. Overloading Methods Section 2.9. Importing Static Member Names Section 2.10. The main Method Section 2.11. Native Methods Chapter 3. Extending Classes Section 3.1. An Extended Class Section 4 5 3.2. Constructors in Extended Classes Section 3.3. Inheriting and Redefining Members Section 3.4. Type Compatibility and Conversion Section 3.5. What protected Really Means Section 3.6. Marking Methods and Classes final Section 3.7. Abstract Classes and Methods Section 3.8. The Object Class Section 3.9. Cloning Objects Section 3.10. Extending Classes: How and When Section 3.11. 5 6 Designing a Class to Be Extended Section 3.12. Single Inheritance versus Multiple Inheritance Chapter 4. Interfaces Section 4.1. A Simple Interface Example Section 4.2. Interface Declarations Section 4.3. Extending Interfaces Section 4.4. Working with Interfaces Section 4.5. Marker Interfaces Section 4.6. When to Use Interfaces Chapter 5. Nested Classes and Interfaces Section 5.1. Static 6 7 Nested Types Section 5.2. Inner Classes Section 5.3. Local Inner Classes Section 5.4. Anonymous Inner Classes Section 5.5. Inheriting Nested Types Section 5.6. Nesting in Interfaces Section 5.7. Implementation of Nested Types Chapter 6. Enumeration Types Section 6.1. A Simple Enum Example Section 6.2. Enum Declarations Section 6.3. Enum Constant Declarations Section 6.4. java.lang.Enum 7 8 Section 6.5. To Enum or Not Chapter 7. Tokens, Values, and Variables Section 7.1. Lexical Elements Section 7.2. Types and Literals Section 7.3. Variables Section 7.4. Array Variables Section 7.5. The Meanings of Names Chapter 8. Primitives as Types Section 8.1. Common Fields and Methods Section 8.2. Void Section 8.3. Boolean Section 8.4. Number 8 9 Section 8.5. Character Section 8.6. Boxing Conversions Chapter 9. Operators and Expressions Section 9.1. Arithmetic Operations Section 9.2. General Operators Section 9.3. Expressions Section 9.4. Type Conversions Section 9.5. Operator Precedence and Associativity Section 9.6. Member Access Chapter 10. Control Flow Section 10.1. Statements and Blocks Section 10.2. ifelse Section 10.3. switch Section 10.4. 9 10 while and dowhile Section 10.5. for Section 10.6. Labels Section 10.7. break Section 10.8. continue Section 10.9. return Section 10.10. What, No goto? Chapter 11. Generic Types Section 11.1. Generic Type Declarations Section 11.2. Working with Generic Types Section 11.3. Generic Methods and Constructors Section 11.4. Wildcard Capture Section 11.5. Under the Hood: Erasure 10 11 and Raw Types Section 11.6. Finding the Right Method Revisited Section 11.7. Class Extension and Generic Types Chapter 12. Exceptions and Assertions Section 12.1. Creating Exception Types Section 12.2. throw Section 12.3. The throws Clause Section 12.4. try, catch, and finally Section 12.5. Exception Chaining Section 12.6. Stack Traces Section 12.7. When to Use 11 12 Exceptions Section 12.8. Assertions Section 12.9. When to Use Assertions Section 12.10. Turning Assertions On and Off Chapter 13. Strings and Regular Expressions Section 13.1. Character Sequences Section 13.2. The String Class Section 13.3. Regular Expression Matching Section 13.4. The StringBuilder Class Section 13.5. Working with UTF-16 Chapter 14. Threads Section 14.1. Creating Threads 12 13 Section 14.2. Using Runnable Section 14.3. Synchronization Section 14.4. wait, notifyAll, and notify Section 14.5. Details of Waiting and Notification Section 14.6. Thread Scheduling Section 14.7. Deadlocks Section 14.8. Ending Thread Execution Section 14.9. Ending Application Execution Section 14.10. The Memory Model: Synchronization and volatile Section 14.11. Thread Management, Security, and ThreadGroup Section 14.12. 13 14 Threads and Exceptions Section 14.13. ThreadLocal Variables Section 14.14. Debugging Threads Chapter 15. Annotations Section 15.1. A Simple Annotation Example Section 15.2. Annotation Types Section 15.3. Annotating Elements Section 15.4. Restricting Annotation Applicability Section 15.5. Retention Policies Section 15.6. Working with Annotations Chapter 16. Reflection Section 16.1. The Class Class Section 16.2. Annotation Queries 14 15 Section 16.3. The Modifier Class Section 16.4. The Member classes Section 16.5. Access Checking and AccessibleObject Section 16.6. The Field Class Section 16.7. The Method Class Section 16.8. Creating New Objects and the Constructor Class Section 16.9. Generic Type Inspection Section 16.10. Arrays Section 16.11. Packages Section 16.12. The Proxy Class Section 16.13. Loading 15 16 Classes Section 16.14. Controlling Assertions at Runtime Chapter 17. Garbage Collection and Memory Section 17.1. Garbage Collection Section 17.2. A Simple Model Section 17.3. Finalization Section 17.4. Interacting with the Garbage Collector Section 17.5. Reachability States and Reference Objects Chapter 18. Packages Section 18.1. Package Naming Section 18.2. Type Imports Section 18.3. Package Access 16 17 Section 18.4. Package Contents Section 18.5. Package Annotations Section 18.6. Package Objects and Specifications Chapter 19. Documentation Comments Section 19.1. The Anatomy of a Doc Comment Section 19.2. Tags Section 19.3. Inheriting Method Documentation Comments Section 19.4. A Simple Example Section 19.5. External Conventions Section 19.6. Notes on Usage Chapter 20. The I/O Package 17 18 Section 20.1. Streams Overview Section 20.2. Byte Streams Section 20.3. Character Streams Section 20.4. InputStreamReader and OutputStreamWriter Section 20.5. A Quick Tour of the Stream Classes Section 20.6. The Data Byte Streams Section 20.7. Working with Files Section 20.8. Object Serialization Section 20.9. The IOException Classes Section 20.10. A Taste of New I/O 18 19 Chapter 21. Collections Section 21.1. Collections Section 21.2. Iteration Section 21.3. Ordering with Comparable and Comparator Section 21.4. The Collection Interface Section 21.5. Set and SortedSet Section 21.6. List Section 21.7. Queue Section 21.8. Map and SortedMap Section 21.9. enum Collections Section 21.10. Wrapped Collections and the Collections Class Section 21.11. Synchronized Wrappers and Concurrent 19 20 Collections Section 21.12. The Arrays Utility Class Section 21.13. Writing Iterator Implementations Section 21.14. Writing Collection Implementations Section 21.15. The Legacy Collection Types Section 21.16. Properties Chapter 22. Miscellaneous Utilities Section 22.1. Formatter Section 22.2. BitSet Section 22.3. Observer/Observable Section 22.4. Random Section 22.5. Scanner Section 22.6.
Recommended publications
  • The Performance Paradox of the JVM: Why More Hardware Means More
    Expert Tip The Performance Paradox of the JVM: Why More Hardware Means More As computer hardware gets cheaper and faster, administrators managing Java based servers are frequently encountering serious problems when managing their runtime environments. JVM handles the task of garbage collection for the developer - cleaning up the space a developer has allocated for objects once an instance no longer has any references pointing to it. Some garbage collection is done quickly and invisibly. But certain sanitation tasks, which fortunately occur with minimal frequency, take significantly longer, causing the JVM to pause, and raising the ire of end users and administrators alike. Read this TheServerSide.com Expert Tip to better understand the JVM performance problem, how the JVM manages memory and how best to approach JVM Performance. Sponsored By: TheServerSide.com Expert Tip The Performance Paradox of the JVM: Why More Hardware Means More Expert Tip The Performance Paradox of the JVM: Why More Hardware Means More Table of Contents The Performance Paradox of the JVM: Why More Hardware Means More Failures Resources from Azul Systems Sponsored By: Page 2 of 8 TheServerSide.com Expert Tip The Performance Paradox of the JVM: Why More Hardware Means More The Performance Paradox of the JVM: Why More Hardware Means More Failures By Cameron McKenzie The Problem of the Unpredictable Pause As computer hardware gets cheaper and faster, administrators managing Java based servers are frequently encountering serious problems when managing their runtime environments. While our servers are getting decked out with faster and faster hardware, the Java Virtual Machines (JVMs) that are running on them can't effectively leverage the extra hardware without hitting a wall and temporarily freezing.
    [Show full text]
  • Java (Programming Langua a (Programming Language)
    Java (programming language) From Wikipedia, the free encyclopedialopedia "Java language" redirects here. For the natural language from the Indonesian island of Java, see Javanese language. Not to be confused with JavaScript. Java multi-paradigm: object-oriented, structured, imperative, Paradigm(s) functional, generic, reflective, concurrent James Gosling and Designed by Sun Microsystems Developer Oracle Corporation Appeared in 1995[1] Java Standard Edition 8 Update Stable release 5 (1.8.0_5) / April 15, 2014; 2 months ago Static, strong, safe, nominative, Typing discipline manifest Major OpenJDK, many others implementations Dialects Generic Java, Pizza Ada 83, C++, C#,[2] Eiffel,[3] Generic Java, Mesa,[4] Modula- Influenced by 3,[5] Oberon,[6] Objective-C,[7] UCSD Pascal,[8][9] Smalltalk Ada 2005, BeanShell, C#, Clojure, D, ECMAScript, Influenced Groovy, J#, JavaScript, Kotlin, PHP, Python, Scala, Seed7, Vala Implementation C and C++ language OS Cross-platform (multi-platform) GNU General Public License, License Java CommuniCommunity Process Filename .java , .class, .jar extension(s) Website For Java Developers Java Programming at Wikibooks Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few impimplementation dependencies as possible.ble. It is intended to let application developers "write once, run ananywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to rurun on another. Java applications ns are typically compiled to bytecode (class file) that can run on anany Java virtual machine (JVM)) regardless of computer architecture. Java is, as of 2014, one of tthe most popular programming ng languages in use, particularly for client-server web applications, witwith a reported 9 million developers.[10][11] Java was originallyy developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems'Micros Java platform.
    [Show full text]
  • The Java® Language Specification Java SE 8 Edition
    The Java® Language Specification Java SE 8 Edition James Gosling Bill Joy Guy Steele Gilad Bracha Alex Buckley 2015-02-13 Specification: JSR-337 Java® SE 8 Release Contents ("Specification") Version: 8 Status: Maintenance Release Release: March 2015 Copyright © 1997, 2015, Oracle America, Inc. and/or its affiliates. 500 Oracle Parkway, Redwood City, California 94065, U.S.A. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. The Specification provided herein is provided to you only under the Limited License Grant included herein as Appendix A. Please see Appendix A, Limited License Grant. To Maurizio, with deepest thanks. Table of Contents Preface to the Java SE 8 Edition xix 1 Introduction 1 1.1 Organization of the Specification 2 1.2 Example Programs 6 1.3 Notation 6 1.4 Relationship to Predefined Classes and Interfaces 7 1.5 Feedback 7 1.6 References 7 2 Grammars 9 2.1 Context-Free Grammars 9 2.2 The Lexical Grammar 9 2.3 The Syntactic Grammar 10 2.4 Grammar Notation 10 3 Lexical Structure 15 3.1 Unicode 15 3.2 Lexical Translations 16 3.3 Unicode Escapes 17 3.4 Line Terminators 19 3.5 Input Elements and Tokens 19 3.6 White Space 20 3.7 Comments 21 3.8 Identifiers 22 3.9 Keywords 24 3.10 Literals 24 3.10.1 Integer Literals 25 3.10.2 Floating-Point Literals 31 3.10.3 Boolean Literals 34 3.10.4 Character Literals 34 3.10.5 String Literals 35 3.10.6 Escape Sequences for Character and String Literals 37 3.10.7 The Null Literal 38 3.11 Separators
    [Show full text]
  • A Pairwise Abstraction for Round-Based Protocols
    A Pairwise Abstraction for Round-Based Protocols Lonnie Princehouse Nate Foster Ken Birman Department of Computer Science, Cornell University f lonnie, jnfoster, ken [email protected] Distributed systems are hard to program, for a number of make predictable use of the network. As such, they are reasons. Some of these reasons are inherent. System state “good neighbors” in massive multi-tenant data centers, such is scattered across multiple nodes, and is not random ac- as those that drive Amazon’s EC2. Many cloud computing cess. Bandwidth is an ever-present concern. Fault tolerance services have relaxed consistency requirements in favor of is much more complicated in a partial-failure model. This availability, and this also plays to the strengths of round- presents both a challenge and an opportunity for the pro- based protocols. gramming languages community: What should languages Our goal with CPG is to design abstractions for describ- for distributed systems look like? What are the shortcom- ing these protocols that make it easy to develop richer proto- ings of conventional languages for describing systems that cols via composition and code re-use. The fundamental unit extend beyond a single machine? seen by programmers in CPG is a pair of nodes. A protocol Prior work in this area has produced diverse solutions. in CPG is defined using a select function, which identifies The DryadLINQ [7] language expresses distributed compu- pairs of nodes to communicate in each round, and an up- tations using SQL-like queries. BLOOM [1] also follows a date function, which takes the states of the selected nodes data-centric approach, but assumes an unordered program- as input and produces their updated states after communica- ming model by default.
    [Show full text]
  • In This Day of 3D Graphics, What Lets a Game Like ADOM Not Only Survive
    Ross Hensley STS 145 Case Study 3-18-02 Ancient Domains of Mystery and Rougelike Games The epic quest begins in the city of Terinyo. A Quake 3 deathmatch might begin with a player materializing in a complex, graphically intense 3D environment, grabbing a few powerups and weapons, and fragging another player with a shotgun. Instantly blown up by a rocket launcher, he quickly respawns. Elapsed time: 30 seconds. By contrast, a player’s first foray into the ASCII-illustrated world of Ancient Domains of Mystery (ADOM) would last a bit longer—but probably not by very much. After a complex process of character creation, the intrepid adventurer hesitantly ventures into a dark cave—only to walk into a fireball trap, killing her. But a perished ADOM character, represented by an “@” symbol, does not fare as well as one in Quake: Once killed, past saved games are erased. Instead, she joins what is no doubt a rapidly growing graveyard of failed characters. In a day when most games feature high-quality 3D graphics, intricate storylines, or both, how do games like ADOM not only survive but thrive, supporting a large and active community of fans? How can a game design seemingly premised on frustrating players through continual failure prove so successful—and so addictive? 2 The Development of the Roguelike Sub-Genre ADOM is a recent—and especially popular—example of a sub-genre of Role Playing Games (RPGs). Games of this sort are typically called “Roguelike,” after the founding game of the sub-genre, Rogue. Inspired by text adventure games like Adventure, two students at UC Santa Cruz, Michael Toy and Glenn Whichman, decided to create a graphical dungeon-delving adventure, using ASCII characters to illustrate the dungeon environments.
    [Show full text]
  • Bibliography of Concrete Abstractions: an Introduction To
    Out of print; full text available for free at http://www.gustavus.edu/+max/concrete-abstractions.html Bibliography [1] Harold Abelson, Gerald J. Sussman, and friends. Computer Exercises to Accom- pany Structure and Interpretation of Computer Programs. New York: McGraw- Hill, 1988. [2] Harold Abelson and Gerald Jay Sussman. Structure and Interpretation of Com- puter Programs. Cambridge, MA: The MIT Press and New York: McGraw-Hill, 2nd edition, 1996. [3] Alfred V. Aho and Jeffrey D. Ullman. Foundations of Computer Science.New York: Computer Science Press, 1992. [4] Ronald E. Anderson, Deborah G. Johnson, Donald Gotterbarn, and Judith Perville. Using the new ACM code of ethics in decision making. Communica- tions of the ACM, 36(2):98±107, February 1993. [5] Ken Arnold and James Gosling. The Java Programming Language. Reading, MA: Addison-Wesley, 2nd edition, 1998. [6] Henk Barendregt. The impact of the lambda calculus in logic and computer science. The Bulletin of Symbolic Logic, 3(2):181±215, June 1997. [7] Grady Booch. Object-oriented Analysis and Design with Applications.Menlo Park, CA: Benjamin/Cummings, 2nd edition, 1994. [8] Charles L. Bouton. Nim, a game with a complete mathematical theory. The Annals of Mathematics, 3:35±39, 1901. Series 2. [9] Mary Campione and Kathy Walrath. The Java Tutorial: Object-Oriented Pro- gramming for the Internet. Reading, MA: Addison-Wesley, 2nd edition, 1998. Excerpted from Concrete Abstractions; copyright © 1999 by Max Hailperin, Barbara Kaiser, and Karl Knight 649 650 Bibliography [10] Canadian Broadcasting Company. Quirks and quarks. Radio program, Decem- ber 19, 1992. Included chocolate bar puzzle posed by Dr.
    [Show full text]
  • Towards Rogue-Soar: Amulet of Yendor Using Its Levitation Capabilities.” Combining Soar, Curses and Micropather
    Gameplay The purpose of Rogue is “to descend into the Dungeons of Doom, defeat monsters, find treasure, and return to the surface with the Towards Rogue-Soar: amulet of Yendor using its levitation capabilities.” Combining Soar, Curses and Micropather Johnicholas Hines Advisor: Clare Bates Congdon May 17, 2010 Figure: The player (‘@’) is fighting a bat (‘B’). History Novelty I In the late 1970s, Ken Arnold designed a library (later named Rogue does not seem like a novel environment for Soar. curses[1]) to put characters at specific locations, enabling a I Discrete-Space crude form of interactive graphics. I Discrete-Time / Synchronous I Using this library, Michael Toy and Glen Wichman designed I Two-Dimensional Rogue[4]. I Single-Agent I In 1983, Rogue became popular when it was included in BSD Unix 4.2. Why should you be interested? I In 1984, Michael L. Mauldin, Guy Jacobson, Andrew Appel, and Leonard Hamey published “Rog-o-matic: A belligerent expert system”[3]. I In 1987, John Laird, Paul Rosenbloom, and Allen Newell published “Soar: An Architecture for General Intelligence”[2]. Is writing an Rog-o-matic-competitive agent easy now? Why you should be interested Rogue-Soar I/O I Rogue is a real human activity; people played it. ˆio I Rogue has been previously studied. ˆinput-link ˆspot I Because Rogue was written decades ago, it is now fast. ˆrow <0..23> I The generic I/O link could be reused for other curses-based ˆcolumn <0..79> roguelikes (ADoM, Angband, Crawl, Moria, NetHack). ˆcontents <char> I The generic I/O link could be reused for other curses-based ˆoutput-link applications (vi, emacs, lynx, w3m).
    [Show full text]
  • Cisc 7124X [*709.2X]
    Brooklyn College Department of Computer & Information Sciences CISC 7124 [*709.2X] Object-Oriented Programming 37½ hours plus conference and independent work; 3 credits Object-oriented programming concepts and techniques: data abstraction and encapsulation, classes, inheritance, overloading, polymorphism, interfaces. Introduction to and use of one or more object-oriented languages such as C++ or Smalltalk. An introduction to object-oriented design. Syllabus Procedural programming in Java Introduction to object-oriented design and programming View classes as abstract data types o Int class o Rectangle class o Stack class o Queue class Object-oriented programming in Java (Classes, Methods, Messages, and Instances) o Built-in classes . Boolean, Character, Byte, Short, Integer, Long, Float, Double, String & StringBuffer, Vector, Hashtable Interfaces and Packages Collections Inheritance Midterm exam (BinaryTree.java | SumLines.java) I/O o Echo.java o CopyTextFile.java Graphics programming with AWT (Components & Graphic & Layout managers) o TestDrawString.java o TestImage.java Event handling o TestEvent.java o TestCardLayout.java o TestImageCards.java Applets Advanced topics o Network programming with sockets o Multithreaded programming and animation . DigitClock.java . Greeting1.java . AnimatedImage.java . PingPong.java . ProducerConsumer.java . Clocks.java o JDBC and MySql o Servlet programming Textbook : The Java Tutorial: A Short Course on the Basics, 4th Edition Bibliography: Big Java: Programming and Practice, by Cay S. Horstmann, Wiley, 2002. A Programmer's Guide to Java (tm) Certification -- Khalid Azim Mughal, Rolf Rasmussen, 2000. Core Java 2, Volume I -- Fundamentals, by Cay S. Horstmann and Gary Cornell, Prentice Hall, 1999. Introduction to Programming Using Java : An Object-Oriented Approach, by David M. Arnow, Gerald Weiss, Addison-Wesley, 1998.
    [Show full text]
  • Java (Software Platform) from Wikipedia, the Free Encyclopedia Not to Be Confused with Javascript
    Java (software platform) From Wikipedia, the free encyclopedia Not to be confused with JavaScript. This article may require copy editing for grammar, style, cohesion, tone , or spelling. You can assist by editing it. (February 2016) Java (software platform) Dukesource125.gif The Java technology logo Original author(s) James Gosling, Sun Microsystems Developer(s) Oracle Corporation Initial release 23 January 1996; 20 years ago[1][2] Stable release 8 Update 73 (1.8.0_73) (February 5, 2016; 34 days ago) [±][3] Preview release 9 Build b90 (November 2, 2015; 4 months ago) [±][4] Written in Java, C++[5] Operating system Windows, Solaris, Linux, OS X[6] Platform Cross-platform Available in 30+ languages List of languages [show] Type Software platform License Freeware, mostly open-source,[8] with a few proprietary[9] compo nents[10] Website www.java.com Java is a set of computer software and specifications developed by Sun Microsyst ems, later acquired by Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment . Java is used in a wide variety of computing platforms from embedded devices an d mobile phones to enterprise servers and supercomputers. While less common, Jav a applets run in secure, sandboxed environments to provide many features of nati ve applications and can be embedded in HTML pages. Writing in the Java programming language is the primary way to produce code that will be deployed as byte code in a Java Virtual Machine (JVM); byte code compil ers are also available for other languages, including Ada, JavaScript, Python, a nd Ruby.
    [Show full text]
  • Object Oriented Programming 2016-2017
    OBJECT ORIENTED PROGRAMMING 2016-2017 Bachelor Degree: Mathematics 701G Course title: Object oriented programming 828 Year/Semester: 2/1S ECTS Credits: 6 DEPARTMENT Address: CCT Building, C/ Madre de Dios 53 City: Logroño Province: La Rioja Postal code: 26007 Phone number: 941299452 Email address: ENGLISH-FRIENDLY FACULTY Name: Jesús María Aransay Azofra Phone number: 941299438 Email address: [email protected] Office: 3245 Building: CCT Name: Jónathan Heras Vicente Phone number: 941299673 Email address: [email protected] Office: 3232 Building: CCT CONTENTS 1. Objects and classes in Object Oriented programming 1.1 Representing information by means of objects 1.2 Attributes or state 1.3 Methods or behavior 1.4 Abstracting objects into classes 1.5 The need and relevance of class constructors: default constructor, user defined constructors 1.6 Access methods and how to modify the state of an object 1.7 Static or class attributes and methods 1.8 Access modifiers: the need for public and private modifiers 1.9 Information hiding: different ways to represent an object without modifying its behavior 1.10 Introduction to UML: representation of objects and classes 1.11 C++: class declaration and object construction 1.12 Java: classes declaration 2. Relations among classes. Class inheritance 2.1 Communication among classes 2.2 Classes containing objects as attributes: some well-known examples 2.3 Specialisation/generalisation relationships 2.4 Definition of class inheritance 2.5 Advantages of using inheritance: code reuse and polymorphism 2.6 Redefinition of methods in subclasses 2.7 Access modifier “protected”: use cases 2.8 Representing class inheritance in UML 2.9 Programming in Java and C++ inheritance relationships 3.
    [Show full text]
  • Scala: How to Make Best Use of Functions and Objects
    Scala: How to make best use of functions and objects Philipp Haller Lukas Rytz Martin Odersky EPFL ACM Symposium on Applied Computing Tutorial Where it comes from Scala has established itself as one of the main alternative languages on the JVM. Prehistory: 1996 – 1997: Pizza 1998 – 2000: GJ, Java generics, javac ( “make Java better” ) Timeline: 2003 – 2006: The Scala “Experiment” 2006 – 2009: An industrial strength programming language ( “make a better Java” ) 2 3 Why Scala? 4 Scala is a Unifier Agile, with lightweight syntax Object-Oriented Scala Functional Safe and performant, with strong static typing 5 What others say: 6 “If I were to pick a language to use today other than Java, it would be Scala.” - James Gosling, creator of Java “Scala, it must be stated, is the current heir apparent to the Java throne. No other language on the JVM seems as capable of being a "replacement for Java" as Scala, and the momentum behind Scala is now unquestionable. While Scala is not a dynamic language, it has many of the characteristics of popular dynamic languages, through its rich and flexible type system, its sparse and clean syntax, and its marriage of functional and object paradigms.” - Charles Nutter, creator of JRuby “I can honestly say if someone had shown me the Programming in Scala book by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy.” - James Strachan, creator of Groovy. 7 Let’s see an example: 8 A class ... public class Person { public final String name; public final int age; Person(String name, int age) { ..
    [Show full text]
  • The Jini/Sup TM/ Architecture: Dynamic Services in a Flexibie Network
    9.3 The JiniTMArchitecture: Dynamic Services in a Flexible Network Ken Arnold Sun Microsystems, Inc. 1 Network Drive Burlington, MA 01 804 +01-781-442-0720 [email protected] 1. ABSTRACT capable printer, the proxy object that implements the This paper gives an overview of the JiniTM Printer interface will convert the text to PostScript and architecture, which provides a federated infra- send it to the printer. A different printing service whose printer uses PCL as a printing language will have a a proxy structure for dynamic services in a network. object that converts the text to PCL commands. Services may be large or small. The universal platform provided by the virtual machine also 1.1 Keywords means that code can be downloaded to the client if necessary. Jini, Java, networks, distribution, distributed computing This means that the client can use services whose implementations were previously unknown. If a client using 2. INTRODUCTION the PostScript capable print service has never used it before, The JiniTM architecture provides an infrastructure for the conversion code can be automatically downloaded on defining, advertising, and finding services in a network. demand by the virtual machine. Clients can talk to services Services are defined by one or more JavaTM language that they have never seen before (and may never see again) interfaces or classes. These types define a contract with the without any human intervention, such as installing drivers on clients of the service. all the systems that will use a new printing service. For example, if a service supports a printer interface it A discovery protocol lets clients and services find available supports a Printer service.
    [Show full text]