admin 管理员组

文章数量: 887021


2024年1月16日发(作者:北京计算机软件培训学校)

Building and Running Applets3 FUNDAMENTAL PROGRAMMING STRUCTURES IN JAVAA Simple Java ProgramCommentsData TypesInteger TypesFloating-Point TypesThe char TypeThe boolean TypeVariablesInitializing VariablesConstantsOperatorsIncrement and Decrement OperatorsRelational and boolean OperatorsBitwise OperatorsMathematical Functions and ConstantsConversions between Numeric TypesCastsParentheses and Operator HierarchyEnumerated TypesStringsSubstringsConcatenationStrings Are ImmutableTesting Strings for EqualityCode Points and Code UnitsThe String APIReading the On-Line API DocumentationBuilding StringsInput and OutputReading InputFormatting OutputFile Input and Output

Control FlowBlock ScopeConditional StatementsLoopsDeterminate LoopsMultiple Selections——The switch StatementStatements That Break Control FlowBig NumbersArraysThe “for each” LoopArray Initializers and Anonymous ArraysArray CopyingCommand-Line ParametersArray SortingMultidimensional ArraysRagged Arrays4 OBJECTS AND CLASSESIntroduction to Object-Oriented ProgrammingClassesObjectsIdentifying ClassesRelationships between ClassesUsing Predefined ClassesObjects and Object VariablesThe GregorianCalendar Class of the Java LibraryMutator and Accessor MethodsDefining Your Own ClassesAn Employee ClassUse of Multiple Source FilesDissecting the Employee ClassFirst Steps with ConstructorsImplicit and Explicit ParametersBenefits of EncapsulationClass-Based Access Privileges

Private MethodsFinal Instance FieldsStatic Fields and MethodsStatic FieldsStatic ConstantsStatic MethodsFactory MethodsThe main MethodMethod ParametersObject ConstructionOverloadingDefault Field InitializationDefault ConstructorsExplicit Field InitializationParameter NamesCalling Another ConstructorInitialization BlocksObject Destruction and the finalize MethodPackagesClass ImportationStatic ImportsAddition of a Class into a PackagePackage ScopeThe Class PathSetting the Class PathDocumentation CommentsComment InsertionClass CommentsMethod CommentsField CommentsGeneral CommentsPackage and Overview CommentsComment ExtractionClass Design Hints

5 INHERITANCEClasses, Superclasses, and SubclassesInheritance HierarchiesPolymorphismDynamic BindingPreventing Inheritance: Final Classes and MethodsCastingAbstract ClassesProtected AccessObject: The Cosmic SuperclassThe equals MethodEquality Testing and InheritanceThe hashCode MethodThe toString MethodGeneric Array ListsAccessing Array List ElementsCompatibility between Typed and Raw Array ListsObject Wrappers and AutoboxingMethods with a Variable Number of ParametersEnumeration ClassesReflectionThe Class ClassA Primer on Catching ExceptionsUsing Reflection to Analyze the Capabilities of ClassesUsing Reflection to Analyze Objects at RuntimeUsing Reflection to Write Generic Array CodeMethod Pointers!Design Hints for Inheritance6 INTERFACES AND INNER CLASSESInterfacesProperties of InterfacesInterfaces and Abstract ClassesObject CloningInterfaces and Callbacks

Inner ClassesUse of an Inner Class to Access Object StateSpecial Syntax Rules for Inner ClassesAre Inner Classes Useful? Actually Necessary? Secure?Local Inner ClassesAccessing final Variables from Outer MethodsAnonymous Inner ClassesStatic Inner ClassesProxiesProperties of Proxy Classes7 GRAPHICS PROGRAMMINGIntroducing SwingCreating a FramePositioning a FrameFrame PropertiesDetermining a Good Frame SizeDisplaying Information in a ComponentWorking with D ShapesUsing ColorUsing Special Fonts for TextDisplaying Images8 EVENT HANDLINGBasics of Event HandlingExample: Handling a Button ClickBecoming Comfortable with Inner ClassesCreating Listeners Containing a Single Method CallExample: Changing the Look and FeelAdapter ClassesActionsMouse EventsThe AWT Event HierarchySemantic and Low-Level Events9 USER INTERFACE COMPONENTS WITH SWINGSwing and the Model-View-Controller Design Pattern

Design PatternsThe Model-View-Controller PatternA Model-View-Controller Analysis of Swing ButtonsIntroduction to Layout ManagementBorder LayoutGrid LayoutText InputText FieldsLabels and Labeling ComponentsPassword FieldsText AreasScroll PanesChoice ComponentsCheckboxesRadio ButtonsBordersCombo BoxesSlidersMenusMenu BuildingIcons in Menu ItemsCheckbox and Radio Button Menu ItemsPop-Up MenusKeyboard Mnemonics and AcceleratorsEnabling and Disabling Menu ItemsToolbarsTooltipsSophisticated Layout ManagementThe Grid Bag LayoutGroup LayoutUsing No Layout ManagerCustom Layout ManagersTraversal OrderDialog Boxes

Option DialogsCreating DialogsData ExchangeFile DialogsColor Choosers10 DEPLOYING APPLICATIONS AND APPLETSJAR FilesThe ManifestExecutable JAR FilesResourcesSealingJava Web StartThe SandboxSigned CodeThe JNLP APIAppletsA Simple AppletThe Applet HTML Tag and Its AttributesThe object TagUse of Parameters to Pass Information to AppletsAccessing Image and Audio FilesThe Applet ContextStorage of Application PreferencesProperty MapsThe Preferences API11 EXCEPTIONS, LOGGING, ASSERTIONS, AND DEBUGGINGDealing with ErrorsThe Classification of ExceptionsDeclaring Checked ExceptionsHow to Throw an ExceptionCreating Exception ClassesCatching ExceptionsCatching Multiple ExceptionsRethrowing and Chaining Exceptions

The finally ClauseAnalyzing Stack Trace ElementsTips for Using ExceptionsUsing AssertionsAssertion Enabling and DisablingUsing Assertions for Parameter CheckingUsing Assertions for Documenting AssumptionsLoggingBasic LoggingAdvanced LoggingChanging the Log Manager ConfigurationLocalizationHandlersFiltersFormattersA Logging RecipeDebugging TipsUsing a Console WindowTracing AWT EventsLetting the AWT Robot Do the WorkUsing a Debugger12 GENERIC PROGRAMMINGWhy Generic Programming?Who Wants to Be a Generic Programmer?Definition of a Simple Generic ClassGeneric MethodsBounds for Type VariablesGeneric Code and the Virtual MachineTranslating Generic ExpressionsTranslating Generic MethodsCalling Legacy CodeRestrictions and LimitationsType Parameters Cannot Be Instantiated with Primitive TypesRuntime Type Inquiry Only Works with Raw Types

You Cannot Throw or Catch Instances of a Generic ClassArrays of Parameterized Types Are Not LegalYou Cannot Instantiate Type VariablesType Variables Are Not Valid in Static Contexts of Generic ClassesBeware of Clashes After ErasureInheritance Rules for Generic TypesWildcard TypesSupertype Bounds for WildcardsUnbounded WildcardsWildcard CaptureReflection and GenericsUsing Class[T] Parameters for Type MatchingGeneric Type Information in the Virtual Machine13 COLLECTIONSCollection InterfacesSeparating Collection Interfaces and ImplementationCollection and Iterator Interfaces in the Java LibraryConcrete CollectionsLinked ListsArray ListsHash SetsTree SetsObject ComparisonQueues and DequesPriority QueuesMapsSpecialized Set and Map ClassesThe Collections FrameworkViews and WrappersBulk OperationsConverting between Collections and ArraysAlgorithmsSorting and ShufflingBinary Search

Simple AlgorithmsWriting Your Own AlgorithmsLegacy CollectionsThe Hashtable ClassEnumerationsProperty MapsStacksBit Sets14 MULTITHREADINGWhat Are Threads?Using Threads to Give Other Tasks a ChanceInterrupting ThreadsThread StatesNew ThreadsRunnable ThreadsBlocked and Waiting ThreadsTerminated ThreadsThread PropertiesThread PrioritiesDaemon ThreadsHandlers for Uncaught ExceptionsSynchronizationAn Example of a Race ConditionThe Race Condition ExplainedLock ObjectsCondition ObjectsThe synchronized KeywordSynchronized BlocksThe Monitor ConceptVolatile FieldsDeadlocksLock Testing and TimeoutsRead/Write LocksWhy the stop and suspend Methods Are Deprecated

Blocking QueuesThread-Safe CollectionsEfficient Maps, Sets, and QueuesCopy on Write ArraysOlder Thread-Safe CollectionsCallables and FuturesExecutorsThread PoolsScheduled ExecutionControlling Groups of TasksSynchronizersSemaphoresCountdown LatchesBarriersExchangersSynchronous QueuesExample: Pausing and Resuming an AnimationThreads and SwingRunning Time-Consuming TasksUsing the Swing WorkerThe Single-Thread RuleAppendixIndex


本文标签: 计算机软件 培训 北京 学校 作者