Java 7 beginners

Source: Internet
Author: User
Tags define exception integer division mathematical functions object serialization
Java 7 Entry classic
Basic Information
Original Title: Ivor Horton's beginning Java, Java 7 Edition
Author: (beauty) Ivor Horton [Translator's introduction]
Press: Tsinghua University Press
ISBN: 9787302289593
Mounting time:
Published on: February 1, July 2012
Start: 16
Page number: 1
Version: 1-1
Category: Computer> Software and programming> JAVA (J #)> JAVA

More about "Java 7 getting started classic"
Introduction
Books
Computer books
This book is suitable for reading whether Java is used to write custom applets embedded in web pages or to write large applications. This book is the most detailed and comprehensive introductory book on the Java language, introducing all the basic knowledge required to use the latest Java JDK 7 Development Program. The book contains a large number of examples, which clearly explains the key concepts involved and demonstrates the complex details of Java development. You can gain invaluable programming experience while reading various chapters, and gradually start to write fully functional Java programs.
Ivor Horton has a unique experience in writing programming books and is well received. Java SE 7 has updated more than 30% of the language features compared to the previous versions. This book introduces all aspects of using this latest version to compile Java programs, it covers all the new features of Java and can lay a solid foundation for readers.
Directory
Java 7 Entry classic
Chapter 1 Introduction to Java 1
1.1 Java Overview 1
1.2 Java features 2
1.3 learning Java 2
1.3.1 Java program 3
1.3.2 Java learning roadmap 3
1.4 Java environment 4
1.5 Object-Oriented Programming in Java 11
1.5.1 what is object 12
1.5.2 how to define object class 13
1.5.3 object operation 15
1.5.4 JAVA Program Statement 17
1.5.5 encapsulation 17
1.5.6 categories and data types 18
1.5.7 class and subclass 18
1.5.8 advantages of using objects 18
1.5.9 mark 18
1.5.10 generic 19
1.6 Java program structure 19
1.6.1 Java class library 19
1.6.2 Java application 21
1.7 Java and Unicode 23
1.8 conclusion 24
1.9 Resource 25
Chapter 2 procedures, data, variables, and computing 27
2.1 data and variable 27
2.1.1 variable name 28
2.1.2 variable name and Unicode 28
2.1.3 variables and types 29
2.2 integer data type 29
2.3 floating point data type 33
2.3.1 floating point literal 33
2.3.2 declare floating point variable 34
2.4 fixed variable value 34
2.5 arithmetic operation 35
2.5.1 integer calculation 35
2.5.2 integer division and remainder 40
2.5.3 increment and Decrement Operators 40
2.5.4 short Integer type calculation 42
2.5.5 Error 43 in integer Arithmetic
2.5.6 floating point computation 43
2.5.7 other floating point Arithmetic Operators 44
2.5.8 errors in Floating Point Arithmetic 44
2.5.9 mixed arithmetic expression 45
2.5.10 explicit conversion 45
2.5.11 automatic type conversion in the value assignment 46
2.6 op = Operator 46
2.7 mathematical functions and constants 47
2.8 storage characters 51
2.8.1 character escape sequence 51
2.8.2 character arithmetic 52
2.9 bits 54
2.9.1 use the and or operators 55
2.9.2 use the XOR operator 58
2.9.3 displacement operation 59
2.9.4-bit operation method 62
2.10 value range: Fixed Integer Set variable 64
2.11 Boolean variable 66
2.12 operator priority 67
2.13 program notes 68
2.14 Conclusion 70
Chapter 2 loop and logic 73
3.1 decision 73
3.1.1 comparison 74
3.1.2 if statement 74
3.1.3 nested if statement 78
3.1.4 compare the enumerated values 81
3.2 logical operators 81
3.2.1 logic and operation 82
3.2.2 logic or operation 84
3.2.3 XOR operation 84
3.2.4 Boolean non-operation 84
3.2.5 test character 85 using the standard library Method
3.3 conditional operator 86
3.4 switch statement 88
3.5 scope of the variable 94
3.6 cycles 96
3.6.1 types of loops 97
3.6.2 use floating point count 103
3.6.3 nested loop 103
3.6.4 continue statement 105
3.6.5 label-specific continue statement 105
3.6.6 use the break statement 107 in a loop
3.7 assertions 112
3.8 Conclusion 114
Chapter 2 arrays and strings 4th
4.1 array 117
4.1.1 The array variable 118
4.1.2 define array 118
4.1.3 array length 119
4.1.4 accessing array element 119
4.1.5 reuse array variable 119
4.1.6 initialize array 120
4.1.7 use array 123
4.1.8 2D array 126
4.1.9 String Array 130
4.2 string 131
4.2.1 string literal 131
4.2.2 create a String object 132
4.2.3 String Array 134
4.3 string operations 135
4.3.1 connect string 135
4.3.2 comparison string 139
4.3.3 string sorting 144
4.3.4 access the character 146 in the string
4.3.5 search for character 148 in a string
4.3.6 search for a substring 149
4.3.7 extract a substring 152
4.3.8 modified version 156 of the string object
4.3.9 create the character array 157 from the string object
4.3.10 use a string to execute a set-based for loop 157
4.3.11 get character 158 in byte array form in string
4.3.12 create a String object 158 from the character array
4.4 variable string 159
4.4.1 create stringbuffer object 160
4.4.2 stringbuffer object capacity: 160
4.4.3 modify the string length for the stringbuffer object by 162
4.4.4 stringbuffer object growth: 162
4.4.5 locate the substring 164
4.4.6 Replace the sub-string 165 in the buffer
4.4.7 insert string 165
4.4.8 extract character 166 from variable strings
4.4.9 other operations on variable strings 167
4.4.10 create a String object 167 from the stringbuffer object
4.5 conclusion 169
Chapter 2 Definition class 5th
5.1 class definition 173
5.1.1 domain 174 in class definition
5.1.2 method 175 in class definition
5.1.3 access variables and Methods 176
5.1.4 final domain 177
5.2 definition class 177
5.3 definition method 178
5.3.1 return value of method 179
5.3.2 parameters 179
5.3.3 define class METHOD 181
5.3.4 class data member 182 in the Access Method
5.3.5 variable this 182
5.3.6 initialize data member 183
5.4 constructor 186
5.4.1 default constructor 187
5.4.2 create a Class Object 188
5.5 define and use classes 190
5.6 Method overload 192
5.6.1 multiple constructors 193
5.6.2 copying objects using constructors 196
5.7 intended audience 196
5.8 recursion 202
5.9 understand package 204
5.9.1 package classes 204
5.9.2 Add a class from the package to the program 207
5.9.3 package and name 208 in the program
5.9.4 import static class member 208
5.9.5 standard package 209
5.10 access control for Class Members 212
5.10.1 use the access attribute 212
5.10.2 set the access attribute 214
5.10.3 Select Access attribute 215
5.11 Nested classes 220
5.11.1 static nesting class 221
5.11.2 use a non-static nested class 225
5.11.3 use a non-top-level nested class 227
5.11.4 local nested class 228
5.12 conclusion 228
Chapter 2 extended classes and inheritance 6th
6.1 use existing Class 231
6.2 class inheritance 233
6.2.1 inherited data member 233
6.2.2 method of inheritance 234
6.2.3 override base class method 237
6.3 @ override mark 239
6.4 select base class access attribute 239
6.5 polymorphism 240
6.6 multi-level inheritance 246
6.7 abstract class 246
6.8 generic superclass 247
6.8.1 tostring () method 249
6.8.2 determining the object type 249
6.8.3 copy object 250
6.9 method of accepting variable number parameters 255
6.10 conversion object 256
6.10.1 timing of object conversion 258
6.10.2 recognition object 259
6.11 enumeration advanced 260
6.12 design 264
6.13 use final modifier 274
6.14 interface 275
6.14.1 encapsulate the constant 275 in the program
6.14.2 method of interface declaration 278
6.14.3 extended API 281
6.14.4 use interface 282
6.14.5 use the interface type as the method parameter 288
6.14.6 nested class in Interface Definition 289
6.14.7 interface and real environment 289
6.15 Anonymous class 289
6.16 conclusion 290
Chapter 2 exception 7th
7.1 basic idea of exceptions 293
7.2 exception type 294
7.2.1 error 295
7.2.2 runtimeexception type exception 295
7.2.3 other subclasses of the exception class 295
7.3 handle exceptions 295
7.3.1 exception 296 thrown by the Setting Method
7.3.2 handle exceptions 296
7.3.3 try code block 296
7.3.4 catch code block 297
7.3.5 capture multiple exception types in a code block 301
7.3.6 finally code block 301
7.3.7 construction method 302
7.3.8 execution sequence 303
7.3.9 nested try code block 309
7.3.10 re-throw an exception 309
7.4 exception object 310
7.4.1 throwable class 310
7.4.2 standard exception 313
7.5 define your own exceptions 313
7.5.1 define exception class 313
7.5.2 throw your own exception 315
7.5.3 exception throw policy 315
7.6 Conclusion 320
Chapter 2 Understanding stream 8th
8.1 stream and input/output operations 323
8.2 concept of stream 324
8.2.1 input and output streams 324
8.2.2 binary stream and swap stream 325
8.3 input/output class 326
8.3.1 basic input stream operation 327
8.3.2 buffered input stream 327
8.3.3 Basic output stream operation 328
8.3.4 stream readers and writers 329
8.4 standard stream 332
8.4.1 read data from the keyboard 333
8.4.2 340 written to the command line
8.4.3 printf () method 340
8.4.4 format the data as a string 345
8.5 conclusion 346
Chapter 4 Access Files And Directories 9th
9.1 access the file system 349
9.2 use path object 351
9.2.1 access to system attributes 353
9.2.2 set System Properties 355
9.2.3 test and check path object 355
9.2.4 Query file and directory 356
9.2.5 get file attributes 357
9.2.6 other path operations 360
9.3 create and delete directories and files 361
9.3.1 create directory 361
9.3.2 Create File 363
9.3.3 delete files and directories 364
9.4 get directory content 365
9.5 close stream 366
9.6 move and copy files and directories 368
9.6.1 rename a file or directory 369
9.6.2 copy files and directories 370
9.6.3 traverse the file tree 375
9.7 conclusion 378
Chapter 2 file writing 10th
10.1 file I/O basics 381
10.2 file output 382
10.3 write a file through the output stream 383
10.4 use writer to write files 386
10.5 buffer zone 389
10.5.1 Buffer Capacity 389
10.5.2 buffer location and limit 390
10.5.3 set the location and limit 391
10.5.4 create a buffer 392
10.5.5 mark buffer 396
10.5.6 buffer data transmission 397
10.5.7 use view buffer 399
10.5.8 prepare a buffer to output to the file 400
10.6 use channels to write files 401
10.6.1 channel API 402
10.6.2 channel operation 403
10.6.3: File Retrieval channel 403
10.6.4 write operations 404
10.7 file write operations 406
10.7.1 write part of the buffer to the file 406
File Location 10.7.2: 409
10.7.3 use view buffer to load byte buffer 410
10.7.4 write a variable-length string to the file 410
10.7.5 direct and indirect buffer 416
10.7.6 use a channel to write a value of 417
10.7.7 write mixed data to the file 421
10.7.8 write 427 from multiple Buffers
10.8 forcibly write data to the device 430
10.9 conclusion 431
Chapter 1 reading a file 11th
11.1 file read Operations 433
11.1.1 use input stream To Read File 434
11.1.2 use a buffer reader to read files 437
11.2 reading files through channels 439
11.2.1 read text file 441
11.2.2 obtain data from the buffer zone 442
11.2.3 read binary data 444
11.2.4 read hybrid data 446
11.2.5 compressed buffer 449
11.3 copy a file 452
11.4 random File Access 455
11.5 memory ing file 460
11.5.1 lock file 463
11.5.2 lock specific part of the file 465
11.5.3 practical File Locking considerations 465
11.6 conclusion 468
Chapter 2 serialization object 12th
12.1 store objects in files 471
12.2 write an object to a file 472
12.2.1 write basic data to object stream 474
12.2.2 serializable interface 475
12.3 read objects from a file 478
12.3.1 determine the class to which the deserialization object belongs 481
12.3.2 use Object serialization 482
12.3.3 manually serialized class 485
12.3.4 serialization problems and difficulties 486
12.4 conclusion 488
Chapter 2 generic model 13th
13.1 what is generic 491
13.2 define generic classes 492
13.2.1 generic class 493
13.2.2 instantiate generic class 495
13.2.3 type of a generic instance at runtime: 500
13.2.4 relationship between generic instances 502
13.2.5 multiple type parameters 502
13.2.6 type parameter scope 503
13.2.7 static domain 504 of generic classes
13.2.8 type parameter boundary 504
13.3 generic and generic interfaces 508
13.3.1 implement the container Class Based on
Set cycle 508
13.3.2 implement iterator function 510
13.3.3 parameterized type of Binary Tree 512
13.4 native type variables 523
13.5 use wildcard type parameters 524
13.5.1 wildcard constraint 526
13.5.2 go deep into class 529
13.6 array and parameterized type 530
13.7 parameterization method 533
13.8 parameterization type and inheritance 539
13.9 conclusion 540
Chapter 2 Collection framework 14th
14.1 understand the collection framework 543
14.2 object set 544
14.2.1 set 544
14.2.2 sequence 545
14.2.3 GEO chart 546
14.3 iterator 547
14.4 collection class 549
14.5 use enumset 552
14.6 array collection class 554
14.6.1 create vector 554
14.6.2 storage object 557
14.6.3 search object 558
14.6.4 remove object 560
14.6.5 search object 561
14.6.6 application vector 562
14.6.8 sort the elements in the set by 566
14.6.9 stack memory 567
14.7 linked list 573
14.8 use map 575
14.8.1 hash process 575
14.8.2 use your class as the key 576
14.8.3 create a hashmap container 577
14.8.4 store, retrieve, and remove objects 578
14.8.5 process all elements in the map 579
14.9 conclusion 589
14.10 exercise 589
Chapter 1 A group of useful classes 15th
15.1 practical method of array 591
15.1.1 fill array 591
15.1.2 copy array 593
15.1.3 compare array 593
15.1.4 sorting of arrays 594
15.1.5 search array 598
15.1.6 use the array content as the string 600
15.2 observable and observer objects 601
15.2.1 class 602 defining the observable object
15.2.2 method 602 of the observable class
15.3 generate random number 605
15.4 Date and Time 608
15.4.1 date class 608
15.4.2 interpretation date object 609
15.4.3 calendar 612
15.5 Regular Expression 618
15.6 use lifecycle object 637
15.6.1 create lifecycle object 637
15.6.2 get the input 638 from the Token Object
15.6.3 test flag 640
15.6.4 define your own mode for the tag 641
15.7 conclusion 642
15.8 exercise 642
Chapter 4 thread 16th
16.1 understand thread 645
16.1.1 creation thread 647
16.1.2 stop thread 652
16.1.3 connection thread 653
16.1.4 Thread Scheduling 654
16.1.5 runnable interface 654
16.2 management thread 656
16.2.1 synchronization 657
16.2.2 deadlock 672
16.3 use executor 674
16.3.1 use executor 674
16.3.2 run callable [v] task 675
16.3.3 future [v] Object method 675
16.3.4 disable thread pool 676
16.4 thread priority 685
16.5 conclusion 687
16.6 exercise 687
Chapter 4 creation window 17th
17.1 graphical user interface in Java 689
17.2 create window 691
17.2.1 design window 692
17.2.2 disable deadlock 692 in Gui code
17.3 components and containers 696
17.3.1 the window and frame components 697
17.3.2 window panel 698
17.4 basic component knowledge 699
17.4.1 attributes of the component 699
17.4.2 component size and position: 700
17.4.2 points and rectangle 703
17.4.3 component visualization 706
17.4.4 swing component 714
17.5 use swing container 716
17.6 container layout manager 718
17.6.1 flow layout manager 719
17.6.2 use the border layout manager 724
17.6.3 use card layout manager 726
17.6.4 use grid layout manager 728.
17.6.5 use boxlayout manager 730
17.6.7 use gridbaglayout manager 736
17.6.8 use springlayout manager 743
17.7 add menu 750 to the window
17.7.1 create jmenu and jmenuitem object 750
17.7.2 create menu 751
17.7.3 add menu item 753
17.7.4 add menu shortcuts and accelerator 757
17.8 conclusion 759
17.9 exercise 759
Chapter 4 handling events 18th
18.1 interactive Java program 761
18.2 event handling process 763
18.3 event 764
18.3.1 low-level event 764
18.3.2 enable the window to process its own event 766
18.3.3 allow other low-level events 768
18.3.4 low-level event listener 769
18.3.5 use adapter class 774
18.3.6 semantic event 776
18.3.7 syntax event listener 776
18.4 processing of semantic events in applet 777
18.4.1 other event handling methods 785
18.4.2 process low-level and semantic events 787
18.5 semantic event listener in applications 788
18.6 use action 794
18.6.1 action interface 794
18.6.2 Action Method 795
18.6.3 use the action as the menu item 796
18.6.4 define action 797
18.7 add toolbar 803
18.8 add menu icon 812
18.9 add tool tip 813
18.10 disable action 815
18.11 conclusion 815
18.12 exercise 815
Chapter 2 drawing in a window 19th
19.1 use model/view architecture 817
19.2 component coordinate system 821
19.3 drawing on components 822
19.3.1 graphic environment 822
19.3.2 plot process 825
19.3.3 rendering operation 826
19.4 shape 826
19.4.1 definition Point class 826
19.4.2 straight lines and rectangular 827
19.4.3 Circular Arc and elliptical 832
19.4.4 curve 835
19.4.5 complex path 843
19.5 fill image 848
19.6 management graphics 853
19.6.1 image 854 in the storage model
16.6.2 Drawing Image 856
19.7 draw with the mouse 857
19.7.1 handling mouse events 857
19.8 define your own graphics class 864
19.8.1 define a straight line 865
19.8.2 define rectangle 866
19.8.3 define circle 868
19.8.4 draw curve 871
19.9 modify the cursor 873
19.10 conclusion 874
19.11 exercise 874
Chapter 2 extended GUI 20th
20.1 create status bar 875
Release 1.1 Status Bar 876 for sketcher
V1.1.2 update panel 878
20.2 use dialog box 880
Choose 2.1 Modal Dialog Box and non-Modal Dialog Box 881
20.2.2 a simple modal dialog box 882
885 instant message dialog box
887 instant input dialog box
20.3 create a text element in the dialog box 889
889 define menu items and toolbar buttons for text
Define 3.2 define text 891
Article 3.3 create text element 892
20.4 font selection dialog box 895
Release 4.1 fontdialog class 896
896 create font dialog box button
Choose 4.3 add data panel 898
4.4 font list 899
Listen 4.5 Display the selected font 901
Ipv4.6 use separation panel 902
4.7 use the fine-tune button 903
20.4.8 use the single-choice button to select the font style 905
Listen 4.9 single-choice button 906
20.5 pop-up menu 908
20.5.1 display pop-up menu 910
913 implement context menu
20.7 change user coordinate system 921
20.8 select Custom color 937
20178.1 use cached image 938
938 using jcolorchooser dialog box
20.8.3 add custom color GUI 939
941
20.9 conclusion 942
20.10 exercise 943
Chapter 4 Filling and printing documents 21st
21.1 serialized sketch 945
21.1.1 achieve serialization 946
21.1.2 serialized element list 946
21.2 basic architecture for saving sketch 946
21.2.1 specify file name 946
21.2.1 verify the directory of the sketch 947
21.2.3 record sketch modification 948
21.2.4 process file menu event 949
21.3 use the File selector 950
21.3.1 display File Save dialog box 950
21.3.2 show file opening dialog box 951
21.3.3 custom file selection dialog box 951
21.4 File Operations 953
21.4.1 create custom file dialog box 954
21.4.2 save operation 955
21.4.3 save as Operation 959
21.4.4 enable file opening 961
21.4.5 start new sketch 963
21.4.6 disable data loss during Shutdown. 964
21. 5. Print 966 in Java
21.5.1 create and use a printerjob object 967
21.5.2 print page 970
21.5.3 print the entire sketch 974.
21.5.4 horizontal printing 978
21.5.5 improve printing performance by 980
21.2.6 implement page setting 981
21.5.7 use Java to Print dialog box 984
21.5.8 multi-page document printing 987
21.5.9 use the book object to print 995
21.5.10 print swing component 997
21.6 conclusion 999
21.7 exercise 1000
Chapter 2 Java and XML 22nd
22.1 XML 1001
22.1.1 role of XML 1002
22.1.2 process XML 1002 in Java
22.2 XML document structure 1002
22.2.1 well-structured XML document 1003
22.2.2 valid XML document 1004
22.2.3 element 1004 in XML documents
22.2.4 attribute 1008 of the element
22.3 XML Data Structure 1011
22.4 document type definition 1011
22.4.1 declare a DTD 1012
22.4.2 define a DTD 1013
22.4.3 DTD 1019 of sketcher
22.5 rules for well-structured documents 1023
22.6 XML namespace 1024
2brl. 1 namespace declaration 1024
22.6.2 XML namespace and DTD 1026
22.7 XML mode 1026
22.7.1 definition mode 1027
22.7.2 definition mode element 1028
22.7.3 specify the Data Type 1029
22.7.4 define attributes of complex elements 1029
Limit of 22.7.5 values: 1030
22.7.6 define attribute group 1031
22.7.7 specify a group of elements option 1031
22.8 sketcher mode 1032
22.8.1 define line element 1033
22.8.2 define the Rectangular Element type 1035
22.8.3 define the circle element type 1035
22.8.4 define the curve element type 1036
22.8.5 define text element type 1037
22.8.6 complete sketcher mode 1037
22.8.7 usage mode document 1041
22.9 programming with XML documents 1041
22.9.1 sax processing 1042
22.9.2 Dom processing 1043
22.10 access parser 1043
22.11 using sax 1044
22.11.1 attributes and features of the parser 1046
22.11.2 parse document 1048 using Sax
22.11.3 implement the sax handler 1049
22.11.4 handle other parsing events 1058
22.11.5 resolution mode instance document 1059
22.12 conclusion 1064
22.13 exercise 1064
Chapter 4 Create and modify an XML document 23rd
23.1 Document Object Model 1067
23.2 set the features of the DOM parser 1069
23.3 parsing document 1070
23.4 navigation Document Object Tree 1071
23.4.1 1072 Node Type
23.4.2 negligible blank space and element content 1077
23.4.3 access attribute 1078
23.5 convert XML 1081
23.6 create Document Object 1085
23.7 store sketch as XML document 1089
23.7.1 add an element node 1090
23.7.2 create Document Object for the completed sketch 1097
23.7.3 Save the sketch as an XML file 1099
23.8 read the XML of the sketch to indicate 1103
23.8.1 create a base class object from XML 1103
23.8.2 create element 1105 from an XML Node
23.8.3 process import XML event 1109
23.8.4 reading XML file 1110
23.8.5 create model 1111
23.9 conclusion 1114
23.10 exercise 1114
Appendix A key word 1117
Appendix B arithmetic 1119 of Computer

This book is from: China Interactive publishing network

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.