Développons En Java

Total Page:16

File Type:pdf, Size:1020Kb

Développons En Java Développons en Java Jean Michel DOUDOUX Table des matières Développons en Java.............................................................................................................................................................1 Préambule..............................................................................................................................................................................2 A propos de ce document.........................................................................................................................................2 Remerciements.........................................................................................................................................................3 Notes de licence.......................................................................................................................................................3 Marques déposées....................................................................................................................................................4 Historique des versions............................................................................................................................................4 Partie 1 : les bases du langage Java....................................................................................................................................6 1. Présentation.......................................................................................................................................................................7 1.1. Les caractéristiques...........................................................................................................................................7 1.2. Bref historique de Java......................................................................................................................................8 1.3. Les différentes éditions et versions de Java......................................................................................................9 1.3.1. Java 1.0....................................................................................................................................................9 1.3.2. Java 1.1....................................................................................................................................................9 1.3.3. Java 1.2..................................................................................................................................................10 1.3.4. Java 1.3..................................................................................................................................................10 1.3.5. Java 1.4 (nom de code Merlin)..............................................................................................................10 1.3.6. Java 1.5 (nom de code Tiger)................................................................................................................11 1.3.7. Les futurs versions de Java...................................................................................................................11 1.3.8. Le résumé des différentes versions.......................................................................................................12 1.3.9. Les extensions du JDK..........................................................................................................................12 1.4. Un rapide tour d'horizon des API et de quelques outils..................................................................................12 1.5. Les différences entre Java et JavaScript..........................................................................................................14 1.6. L'installation du JDK.......................................................................................................................................14 1.6.1. L'installation de la version 1.3 DU JDK de Sun sous Windows 9x......................................................14 1.6.2. L'installation de la documentation de Java 1.3 sous Windows.............................................................16 1.6.3. La configuration des variables système sous Windows 9x...................................................................17 1.6.4. Les éléments du JDK 1.3 sous Windows..............................................................................................18 1.6.5. L'installation de la version 1.4.2 du JDK de Sun sous Windows..........................................................18 1.6.6. L'installation de la version 1.5 beta 1 du JDK de Sun sous Windows..................................................19 2. Les techniques de base de programmation en Java....................................................................................................21 2.1. La compilation d'un code source.....................................................................................................................21 2.2. L'exécution d'un programme et d'une applet...................................................................................................21 2.2.1. L'exécution d'un programme.................................................................................................................21 2.2.2. L'exécution d'une applet........................................................................................................................22 3. La syntaxe et les éléments de bases de java..................................................................................................................23 3.1. Les règles de base............................................................................................................................................23 3.2. Les identificateurs...........................................................................................................................................23 3.3. Les commentaires............................................................................................................................................24 3.4. La déclaration et l'utilisation de variables.......................................................................................................24 3.4.1. La déclaration de variables...................................................................................................................24 3.4.2. Les types élémentaires..........................................................................................................................25 3.4.3. Le format des types élémentaires..........................................................................................................26 3.4.4. L'initialisation des variables..................................................................................................................27 3.4.5. L'affectation..........................................................................................................................................27 3.4.6. Les comparaisons..................................................................................................................................28 3.5. Les opérations arithmétiques...........................................................................................................................29 3.5.1. L'arithmétique entière...........................................................................................................................29 3.5.2. L'arithmétique en virgule flottante........................................................................................................29 3.5.3. L'incrémentation et la décrémentation..................................................................................................30 3.6. La priorité des opérateurs................................................................................................................................31 3.7. Les structures de contrôles..............................................................................................................................32 3.7.1. Les boucles............................................................................................................................................32 3.7.2. Les branchements conditionnels...........................................................................................................33 Développons en Java Table des matières 3. La syntaxe et les éléments de bases de java 3.7.3. Les débranchements..............................................................................................................................34 3.8. Les tableaux.....................................................................................................................................................34 3.8.1. La déclaration des tableaux...................................................................................................................34 3.8.2. L'initialisation explicite d'un tableau....................................................................................................35 3.8.3. Le parcours d'un tableau.......................................................................................................................35 3.9. Les conversions de types.................................................................................................................................35 3.9.1. La conversion d'un entier int en chaine de caractère String..................................................................36
Recommended publications
  • Gaming Cover Front
    Gaming A Technology Forecast Implications for Community & Technical Colleges in the State of Texas Authored by: Jim Brodie Brazell Program Manager for Research Programs for Emerging Technologies Nicholas Kim IC² Institute Program Director Honoria Starbuck, PhD. Eliza Evans, Ph.D. Michael Bettersworth, M.A. Digital Games: A Technology Forecast Authored by: Jim Brodie Brazell Nicholas Kim Honoria Starbuck, PhD. Program Manager for Research, IC² Institute Eliza Evans, Ph.D. Contributors: Melinda Jackson Aaron Thibault Laurel Donoho Research Assistants: Jordan Rex Matthew Weise Programs for Emerging Technologies, Program Director Michael Bettersworth, M.A. DIGITAL GAME FORECAST >> February 2004 i 3801 Campus Drive Waco, Texas 76705 Main: 254.867.3995 Fax: 254.867.3393 www.tstc.edu © February 2004. All rights reserved. The TSTC logo and the TSTC logo star are trademarks of Texas State Technical College. © Copyright IC2 Institute, February 2004. All rights reserved. The IC2 Institute logo is a trademark of The IC2 Institute at The Uinversity of Texas at Austin. This research was funded by the Carl D. Perkins Vocational and Technical Act of 1998 as administered by the Texas Higher Education Coordinating Board. ii DIGITAL GAME FORECAST >> February 2004 Table of Contents List of Tables ............................................................................................................................................. v List of Figures ..........................................................................................................................................
    [Show full text]
  • 1 Introduction
    User Customization of Virtual Network Interfaces with U-Net/SLE David Opp enheimer and Matt Welsh fdavidopp,[email protected] Decemb er 9, 1997 Abstract We describ e U-Net/SLE Safe Language Extensions, a user-level network interface architecture which enables p er-application customization of communication semantics through downloading of user extension applets, imple- mented as Java class les, into the network interface. This architecture p ermits application s to safely sp ecify co de to b e executed within the NI on message transmission and reception. By leveraging the existing U-Net mo del, applications may implement proto col co de at the user level, within the NI, or using some combination of the two. Our current implementation, using the Myricom Myrinet interface and a small Java Virtual Machine subset, obtains go o d p erformance, allowing host communication overhead to b e reduced and improving the overlap of communication and computation during proto col pro cessing. 1 Intro duction Recentwork in high-sp eed interconnects for distributed and parallel computing architectures, particularly workstation clusters, has fo cused on developmentofnetwork interfaces enabling low-latency and high-bandwidth communication. Often, these systems bypass the op erating system kernel to achieve high p erformance; however the features and functionality provided by these di erent systems vary widely. Several systems, such as U-Net [26] and Active Messages [27], virtualize the network interface to provide multiple applications on the same host with direct, protected network access. Other systems, including Fast Messages [16] and BIP [17], eschew sharing the network in lieu of design simplicity and high p erformance.
    [Show full text]
  • Web Services Edge East Conference & Expo Featuring FREE Tutorials, Training Sessions, Case Studies and Exposition
    JAVA & LINUX FOCUS ISSUE TM Java COM Conference: January 21-24, 2003 Expo: January 22-24, 2003 www.linuxworldexpo.com The Javits Center New York, NY see details on page 55 From the Editor Alan Williamson pg. 5 Java & Linux A Marriage Made in Heaven pg. 6 TCO for Linux Linux Fundamentals: Tools of the Trade Mike McCallister ...and J2EE Projects pg. 8 Programming Java in Linux – a basic tour $40010 60 Linux Vendors Life Is About Choices pg. 26 Feature: Managing HttpSession Objects2003 SAVEBrian A. Russell 8 PAGE CONFERENCE Create a well-designed session for a better Web appEAST INSERT PAGE18 63 Career Opportunities Bill Baloglu & Billy Palmieri DGE pg. 72 Integration: PackagingE Java Applications Ian McFarland for OS X Have great looking double-clickable applications 28 Java News ERVICES pg. 60 S EB Specifications: JCP Expert Group Jim Van Peursem JDJ-IN ExcerptsW Experiences – JSR-118 An inside look at the process 42 SPECIALpg. 61 INTERNATIONAL WEB SERVICES CONFERENCE & EXPO Letters to the Editor Feature: The New PDA Profile Jim Keogh OFFER!pg. 62 The right tool for J2ME developers 46 RETAILERS PLEASE DISPLAY UNTIL MARCH 31, 2003 Product Review: exe4j Jan Boesenberg by ej-technologies – a solid piece of software 56 Interview: JDJ Asks ...Sun on Java An exclusive chance to find out what’s going on at Sun 58 SYS -CON Blair Wyman MEDIA Cubist Threads: ‘(Frozen)’ A snow-packed Wyoming highway adventure 74 Everybody’s focused on exposing applications as Web services while letting someone else figure out how to connect them. We’re that someone else.
    [Show full text]
  • The Personaljava Platform: a Revolution
    SUN MICROSYSTEMS BROCHURE PERSONALJAVA™ The PersonalJava™ Platform A REVOLUTION PERSONALJAVA™ TECHNOLOGY FOR CONSUMER DEVICES Since PersonalJava™ technology was introduced, it has enjoyed widespread support and momentum in the consumer electronics industry. PersonalJava technology is a revolutionary software environment designed to bring the power of Java™ technology to personal, consumer, and mobile devices. Based on Sun’s acclaimed Java application environment, PersonalJava technology is ushering in a new era of network-connectable devices that can communicate with a wide range of information sources on the World Wide Web or other network. Already, devices such as web phones, digital set-top boxes, personal digital assistants (PDA’s) and car navigation systems are rolling out with this exciting technology. With the PersonalJava platform, new content and functionality An address book application using the baseline Touchable can be delivered to the device after it is in the hands of look-and-feel design. the end-user, thereby enriching the device’s usefulness and product life. Broad Adoption From its inception, PersonalJava technology was designed to shift the burden of innovation in consumer electronics from hardware to software where the development cycles Applications and Applets are faster, the business model is more leveraged, and the pace of innovation is accelerated. Everything you need for Optional Libraries innovation is already in place, including a broad industry knowledge base about Java software, and the infrastructure to support it. All of this can help you to lower your reliance on proprietary systems and their accompanying support PersonalJava costs. Since writing to the PersonalJava API means using Core Required Libraries Platform the popular Java programming language, the standard Java™ Development Kit (JDK™) toolkit or familiar off-the- shelf development tools can be used.
    [Show full text]
  • OPEN SOURCE VERSUS the JAVA Platformpg. 6
    OPEN SOURCE VERSUS THE JAVA PLATFORM pg. 6 www.JavaDevelopersJournal.com Web Services Edge West 2003 Sept. 30–Oct. 2, 2003 Santa Clara, CA details on pg. 66 From the Editor Best Laid Plans... Alan Williamson pg. 5 Viewpoint In Medias Res Bill Roth pg. 6 Q&A: JDJ Asks... IBM-Rational J2EE Insight Interview with Grady Booch 10 We Need More Innovation Joseph Ottinger pg. 8 Feature: JSP 2.0 Technology Mark Roth J2SE Insight The community delivers a higher performing language 16 Sleeping Tigers Jason Bell pg. 28 Graphical API: Trimming the Fat from Swing Marcus S. Zarra Simple steps to improve the performance of Swing 30 J2ME Insight The MIDlet Marketplace Glen Cordrey pg. 46 Feature: Xlet: A Different Kind of Applet Xiaozhong Wang The life cycle of an Xlet 48 Industry News for J2ME pg. 68 Network Connectivity: java.net.NetworkInterface Duane Morin Letters to the Editor A road warrior’s friend – detecting network connections 58 pg. 70 RETAILERS PLEASE DISPLAY Labs: ExtenXLS Java/XLS Toolkit Peter Curran UNTIL SEPTEMBER 30, 2003 by Extentech Inc. – a pure Java API for Excel integration 62 JSR Watch: From Within the Java Community Onno Kluyt Process Program More mobility, less complexity 72 From the Inside: The Lights Are On, SYS -CON MEDIA but No One’s Home Flipping bits 74 WE’VE ELIMINATED THE NEED FOR MONOLITHIC BROKERS. THE NEED FOR CENTRALIZED PROCESS HUBS. THE NEED FOR PROPRIETARY TOOL SETS. Introducing the integration technology YOU WANT. Introducing the Sonic Business Integration Suite. Built on the Business Integration Suite world’s first enterprise service bus (ESB), a standards-based infrastructure that reliably and cost-effectively connects appli- cations and orchestrates business processes across the extended enterprise.
    [Show full text]
  • Architectural Frameworks for Automated Content Adaptation to Mobile Devices Based on Open-Source Technologies
    Architectural Frameworks for Automated Content Adaptation to Mobile Devices Based on Open-Source Technologies Thesis submitted to the Faculty of Economics of the European University Viadrina (Frankfurt/Oder) in fulfillment of the requirements for the degree of Dr. rer. pol. Author: Bożena Jankowska First Advisor: Prof. Dr. Eberhard Stickel Second Advisor: Prof. Dr. Karl Kurbel Submitted: 03.11.2006 Thesis defense: 06.09.2007 Abstract The Web and enterprise information systems are gradually increasing their reach to a wide range of mobile devices. Although analysts hope for a breakthrough in the popularity of mobile solutions, field studies show that, except for Japan and South Korea, there is still a large gap between the technical capabilities of wireless devices/networks and the adoption of mobile services for business and private use. This paradox can be attributed to a high extent to low quality of existing mobile solutions and to their insufficient usability, represented particularly by two attributes: simplicity of use and content relevance. Additionally, network providers are afraid that mobile Internet could cannibalize their revenues from SMS and entertainment services and do not want to cooperate with service providers to improve the quality of services offered. Wireless applications depend on device-specific features such as input/output mechanisms, screen sizes, computing resources, and support for various multimedia formats and languages. This leads to the need for multi-source authoring - the creation of separate presentations for each device type or, at least, for each class of devices. Multi-source authoring is not a cost-efficient and feasible solution, especially for mobile services consisting of numerous pages.
    [Show full text]
  • JTRON on Javachip
    JavaJavaTMTM SolutionsSolutions forfor EmbeddedEmbedded AppliancesAppliances JTRON on picoJava IITM Electronic Devices Group FUJITSU LIMITED Haruyasu Ito 1 JavaTM - Infrastructure for a Connected World BS DTV SOHO Broadcasters Base Station Home LAN Mobile Broadcasters Navigation System Enterprise System Internet Mobile Phone Mobile terminal E-Commerce IC Card Agent Electronic Watermark Authentication Java Encryption XML WWW mail The Internet’s TCP/IP HTML Multimedia news base technologies 2 JavaTM Characteristics Java TM refers to a application programming language as well as an execution environment developed by Sun Microsystems, that is platform independent. • High programmer productivity → Improved productivity in software development due to being object oriented language, and high reusability etc. • Platform independence → Doesn’t depend on CPU. ‘Write once, run anywhere’. • Ideal for networked communications → Downloadable Java applets (small program + data) → Compact bytecode for transmission. → Built in security for safe network communications. → Equipped with TCP/IP protocol. Through the Internet, has spread rapidly Java 3 JavaTM Developments Downsizing - Expanding into Embedded Devices 95 96 97 98 99 00 01 02 03 04 i-mode i-mode WCDMA phone with Java Home Appliances DTV Navigation Game Mobile Mobile Mainframe PC/WS NC/POS Phone : terminal : •95/3 •96/1 JDK1.0 release •99/2 Java2 source code opened JavaOS/VM Java a-version •97/2 JDK1.1 release goes public •97/11 JavaOS for NCs1.1 •98/8 JavaOS for Business1.0 •98/3 JavaOS for Consumers
    [Show full text]
  • Jini™Architectureoverview
    JiniArchitectureOverview Jim Waldo A Jini system is a Java-centric distributed system designed for simplicity, flexibility,andfederation.TheJiniarchitectureprovidesmechanismsformachines or programs to enter into a federation where each machine or program offers resources to other members of the federation and uses resources as needed. The design of the Jini architecture exploits the ability to move Java language code from machine to machine and unifies under the notion of a service everything from the user of a Jini system to the software available on the machines to the hardware components of the machines themselves. 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303 U.S.A. All rights reserved. Copyright in this document is owned by Sun Microsystems, Inc. Sun Microsystems, Inc. (SUN) hereby grants to you at no charge a nonexclusive, nontransferable, worldwide, limited license (without the right to sublicense) under SUN’s intellectual property rights that are essential to use this Specification for internal evaluation purposes only. Other than this limited license, you acquire no right, title, or interest in or to the Specification and you shall have no right to use the Specification for productive or commercial use. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. Government is subject to restrictions of FAR 52.227-14(g)(2)(6/87) and FAR 52.227-19(6/87), or DFAR 252.227-7015(b)(6/95) and DFAR 227.7202-1(a). This software and documentation is the proprietary information of Sun Microsystems, Inc. You shall use it only in accordance with the terms of the license agreement you entered into with Sun.
    [Show full text]
  • Oct-07 Java Jazz up 1 2 Java Jazz up Oct-07 Editorial
    Oct-07 Java Jazz Up 1 2 Java Jazz Up Oct-07 Editorial Dear Readers, October 2007 Volume I Issue IV We are here again with the fourth issue of Java Jazz-up. The current edition highlights the interesting Java technologies in form of articles developed by the Java “ Just don’t do because others are doing, Give Jazz-up Developer’s Team. This issue reflects our it a thought…. consistent attempts to avail the quality technological Still circumstances want you to do the same updates that enforce the readers to appreciate a lot and Just explore a smarter way to get the deeds be a part of its Readers Community. in perfection ” With this issue, we have begun few of the new sections like Editorial Choice, Java ME and Know The Champions. Published by The Editorial Choice section highlights the editor’s viewpoint orienting around the java innovations in diverse RoseIndia spheres of human interest. This section talks high of JavaFX Technology and tries to avail its features which JavaJazzUp Team aims to provide a consistent user experience across a wide variety of devices including desktops (as applets and stand-alone clients), set-top boxes, mobile devices Editor-in-Chief and Blu-Ray players. Java ME section highlights the role of java in the Deepak Kumar development of softwares for small, resource-constrained devices such as cell phones, PDAs and set-top boxes. Editor-Technical Next, newer section is “Know The Champions” which highlights the “Java Champions program” sponsored by Ravi Kant Sun Microsystems. This program is an effort to recognize Noor-En-Ahmed leaders in the Java Community and invite them to participate in the development of the Java platform in collaboration with Sun engineers and Java Luminaries.
    [Show full text]
  • A Taxonomy of Compositional Adaptation Technical Report MSU-CSE-04-17 May 2004 (Updated July 2004)
    A Taxonomy of Compositional Adaptation Technical Report MSU-CSE-04-17 May 2004 (Updated July 2004) Philip. K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, and Betty H. C. Cheng Software Engineering and Network Systems Laboratory Department of Computer Science and Engineering Michigan State University East Lansing, Michigan 48824 mckinley,sadjadis,kasten,cheng ¡ @cse.msu.edu Abstract Driven by the emergence of pervasive computing and the increasing need for self-managed systems, many approaches have been proposed for building software that can dynamically adapt to its environ- ment. These adaptations involve not only changes in program flow, but also run-time recomposition of the software itself. We discuss the supporting technologies that enable dynamic recomposition and clas- sify different approaches according to how, when and where recomposition occurs. We also highlight key challenges that need to be addressed to realize the full potential of run-time adaptable software. This survey is intended to be a living document, updated periodically to summarize and classify new contri- butions to the field. The document is maintained under the RAPIDware project web site, specifically, at http://www.cse.msu.edu/rapidware/survey. Keywords: adaptive software, compositional adaptation, middleware, survey, taxonomy, pervasive com- puting, autonomic computing, computational reflection, separation of concerns, component-based de- sign, aspect-oriented programming, object-oriented programming. 1 Introduction Interest in adaptive computing systems has grown dramatically in the past few years, and the research community has responded. A variety of techniques now enable software to adapt dynamically to its current use or environmental conditions. Even the structure of the software itself can be changed during execution to fix errors, improve performance, enhance fault tolerance, or harden security in response to attack.
    [Show full text]
  • Ispitivanje Sigurnosti Mobilnih Aplikacija
    Ispitivanje sigurnosti mobilnih aplikacija studeni 2011. CIS-DOC-2011-11-030 Ispitivanje sigurnosti mobilnih aplikacija Upozorenje Podaci, informacije, tvrdnje i stavovi navedeni u ovom dokumentu nastali su dobrom namjerom i dobrom voljom te profesionalnim radom CIS-ovih stru čnjaka, a temelje se na njihovom znanju i petnaestak godina iskustva u radu u informacijskoj sigurnosti. Namjera je da budu to čni, precizni, aktualni, potpuni i nepristrani. Ipak, oni su dani samo kao izvor informacija i CIS ne snosi nikakvu izravnu ili posrednu odgovornost za bilo kakve posljedice nastale korištenjem podataka iz ovog dokumenta. Ukoliko primijetite bilo kakve neto čnosti, krive podatke ili pogreške u ovom dokumentu, ili imate potrebu komentirati sadržaj molimo Vas da to javite elektroni čkom poštom na adresu [email protected] . O CIS-u CIS izra đuje pregledne dokumente (eng. white paper) na teme iz podru čja informacijske sigurnosti koji će biti korisni zainteresiranoj javnosti, a u svrhu podizanje njezine svijesti o informacijskoj sigurnosti i sposobnosti za čuvanje i zaštitu informacija i informacijskih sustava . Pored toga, CIS razvija i održava mrežni portal www.CIS.hr kao referalnu to čku za informacijsku sigurnost za cjelokupnu javnost; izra đuje obrazovne materijale namijenjene javnosti; organizira doga đaje za podizanje svijesti o informacijskoj sigurnosti u javnosti i pojedinim skupinama te djeluje u suradnji sa svim medijima. CIS okuplja mlade zainteresirane za informacijsku sigurnost i radi na njihovom pravilnom odgoju i obrazovanju u podru čju informacijske sigurnosti te pripremu za profesionalno bavljenje informacijskom sigurnoš ću. Centar informacijske sigurnosti [CIS] nastao je 2010. godine na poticaj Laboratorija za sustave i signale[LSS] Zavoda za elektroni čke sustave i obradbu informacija Fakulteta elektrotehnike i ra čunarstva Sveu čilišta u Zagrebu, a kao posljedica 15togodišnjeg rada na istraživanju, razvoju i primjeni informacijske sigurnosti.
    [Show full text]
  • The Largest Java & Web Services Expo
    THE LARGEST JAVA & WEB SERVICES EXPO IN THE WORLD! P.99 TM The World’s Leading Java Resource Java COM May 2002 Volume:7 Issue:5 FULL CONFERENCE PROGRAM INSIDE PAGE 99 Database Systems: Optimizing Database Didier Cabannes 12 From the Editor Performance in J2EE Apps The best of both worlds Alan Williamson pg. 7 Feature: The Critical Role of Walter Hurst J2EE Editorial Application Architecture A fundamental issue 22 Ajit Sagar pg. 9 J2SE Editorial Show Review: First Impressions Ajit Sagar Keith Brown pg. 36 JavaOne 2002: How did it measure up to past shows? 30 J2ME Editorial AI: Programming Neural Networks in Java Jeff Heaton Jason R. Briggs pg. 62 An efficient way to perform certain operations 38 Industry Commentary Kuldip Singh Pabla pg. 64 JDBC 3.0: Something for Everyone John Goodson The new features and why they’re important 56 JDJ Labs Enterprise JavaBeans pg.90 Java-Miner pg. 92 Jini & J2ME: Jini Surrogate As a Platform William Swaney Using HTTP as a protocol 66 RETAILERS PLEASE DISPLAY for J2ME Games UNTIL JULY 31, 2002 Feature: OSGi: The Last Mile of Peter Kriens Software Deployment Solve last-minute problems 74 Pro Mobile: Keep Mobile Data and Applications Jeff Capone in Sync with Java An integral part of your mobile strategy Java Clients 84 Intermittent Connectivity WAP/Brows Based Clien ateways I SYS -CON App Management: Manifest Destiny Norman Richards MEDIA Simplify the packaging and releasing of Java applications 94 Sonic Software www.sonicsoftware.com 2 MAY 2002 Java COM Zero G www.zerog.com MAY 2002 3 Java COM Apple Computer, Inc.
    [Show full text]