Java 7 Programming

Source: Internet
Author: User
Tags object serialization java se
Author: (plus) Budi kurniawan Translator: Yu Limin Xu zhoule Yu Zhe book series name: Chapter Hua Professional Developers Publishing House: Machinery Industry Publishing House ISBN: 9787111390305 Release Date: August 2012 Release Date: 16 open pages: 1 release: 1-1 category: Computer> Software and programming> JAVA (J #)> JAVA



For more information, Java 7 Programming, computer books, Java 7 Programming, Senior Java technical experts, Senior Java Enterprise Application architects, and how Tomcat works written by the author, authority is beyond doubt. Based on the latest Java 7, it comprehensively explains three topics: Java programming language, Java object-oriented technology, and Java core class libraries, including a large number of cases, it is a Bible-level book that systematically learns Java 7 programming. This book is a comprehensive and systematic tutorial for Java SE 7 Programming, covering three topics: Java programming language, Java Oop, and Java core class libraries. This book first introduces the basics of Java 7, including syntax, statements, objects and classes, core classes, inheritance, and error handling, to help readers get started with Java 7; then, the interface and abstract class, enumeration, set framework, generics, input and output, nested classes, and internal classes are thoroughly parsed. Understanding this part helps you understand the underlying principles of Java; next I will explain the basic and advanced knowledge of swing, polymorphism, annotation, internationalization, Java Network, JDBC, Java thread, concurrency tool, security, Java Web application, JavaServer pages, javadoc, and Application Deployment. mastering this part helps improve programming skills. Java 7 program design has a clear structure and interlocking structure, so that readers can learn the Java language efficiently. This book is a reference book for professional Java programmers, and can also be used as a computer-related professional teaching material. The first Java program 1 1.1.1 compiling Java program 1 1.1.2 compiling Java program 1 1.1.3 running Java program 2 1st Java coding specifications 2. 1.3 integrated development environment (IDE) 3 1.4 Summary 4 Exercise 4 Chapter 2nd language basics 5 2.1 ASCII and unicode5 2.2 delimiter 7 2.3 Basic Type 7 2.4 variable 8 2.5 constant 10 2.6 literal 11 2.6.1 integer literal 11 2.6.2 floating point literal 12 2.6.3 Boolean literal 13 2.6.4 character literal 13 2.7 basic type conversion 14 2.7.1 extended conversion 14 2.7.2 reduced conversion 15 2.8 operator 15 2.8.1 unary operator 16 2.8.2 Arithmetic Operator 18 2.9 annotation 24 2.10 conclusion 25 exercise 25 Chapter 14 Statement 26 3rd Java statement overview 26 3.1 If Statement 2 7 3.3 While statement 29 3.4 do-while statement 30 3.5 for statement 31 3.6 break statement 34 3.7 continue statement 35 3.8 switch statement 35 3.9 summary 36 exercises 36 Chapter 4th objects and classes 38 4.1 what is a Java object 38 4.2 Java class 39 4.2.1 domain 40 4.2.2 Method 40 4.2.3 class member 42 4.3 create object 42 4.4 keyword null43 4.5 Memory Object 43 4.6 Java package 46 4.7 Encapsulation and access control 47 4.7.1 class Access Control modifier 47 4.7.2 class members access control modifier 49 4.8 keyword this51 4.9 use other class 52 4.10 final variable 53 4.11 static member 54 4.12 static final variable 55 4.13 static import 56 4.14 variable scope 57 4.15 method overload 58 4.16 value assignment pass back Is Reference pass 59 4.17 load, link and initialization 59 4.17.1 load 60 4.17.2 link 60 4.17.3 initialization 60 4.18 object creation initialization 61 4.19 object comparison 64 4.20 Garbage Collector 64 4.21 Summary 64 exercises 65 5th chapter 66 core Classes 5.1 Java. lang. object66 5.2 Java. lang. string67 5.2.1 compares two string objects 68 5.2.2 string literal quantity 69 5.2.3 character escape 69 5.2.4 switch string 69 5.2.5 string class constrtor 70 5.2.6 string class Method 71 5.3 Java. lang. stringbuffer and Java. lang. stringbuilder73 5.3.1 stringbuilder class constrtor 73 5.3.2 stringbuilder class method 74 5.4 Basic type package Install 74 5.4.1 Java. lang. integer75 5.4.2 Java. lang. boolean75 5.4.3 Java. lang. character76 5.5 array 76 5.5.1 iteration array 78 5.5.2 modify array size 78 5.5.3 pass string array to main80 5.6 Java. lang. class80 5.7 Java. lang. system81 5.8 Java. util. scanner85 5.9 packing and unpacking 85 5.10 variable parameters 85 5.11 format and printf method 86 5.12 summary 87 exercises 87 chapter 6th inheritance 88 6.1 inheritance overview 88 6.1.1 keywords extends88 6.1.2 is-a relationship 89 6.2 accessibility 90 6.3 method coverage 91 6.4 calling the super class constructor 92 6.5 calling the hidden Member of the super class 94 6.6 type conversion 94 6.7 final class 95 6.8 keyword instanceof95 6.9 summary 96 exercise 96 chapter 7th error handling 97 7.1 catch exception 97 7.2 no catch try99 7.3 catch multiple exceptions 99 7.4 try-with-resources statement 99 7.5 Java. lang. exception class 100 7.6 thrown exception from method 101 7.7 custom exception 102 7.8 Exception Handling summary 103 summary 7.9 exercise 104 Chapter 104 number and date 8th Number Parsing 105 8.1 number formatting 105 8.3 use Java. text. numberformat parses the number 107 8.4 Java. lang. math class 107 8.5 Java. util. date class 108 8.6 Java. util. calendar class 109 8.7 use dateformat for date parsing and formatting 110 8.7.1 dateformat110 8. 7.2 simpledateformat111 8.8 summary 112 exercise 112 chapter 9th concepts of interfaces and abstract classes 113 9.1 113 concepts of interfaces 9.2 from a technical perspective interface 114 9.2.1 domain 115 9.2.2 method 115 9.3 base class 116 9.4 abstract class 117 9.5 summary 118 exercise 118 Chapter 10th enumeration 119 10.1 enumeration overview 119 enumeration in class 10.2 120 10.3 Java. lang. enum class 121 10.4 iterative enumeration value 121 10.5 enumeration application in switch 121 10.6 summary 122 exercises 122 chapter 11th Collection framework 123 Collection framework overview 11.1 123 collection interface 11.2 124 list and arraylist124 11.3 use iterator and for iterations set 126 11.5 set and hashset127 11.6 queue and javaslist1 28 11.7 set conversion 129 11.8 map and hashmap129 11.9 object comparison and sorting 130 11.9.1 use Java. lang. comparable130 11.9.2 use comparable and comparator133 11.10 summary 136 exercise 136 chapter 12th generic 137 12.1 life cycle without generics 137 12.2 introduction to generic types 138 use generic types without type parameters 12.3 140 use "?" Wildcard 141 12.5 use bounded wildcards in Methods 143 12.6 write generic types 144 summary 12.7 exercise 145 chapter 145 input/output 13th file system and path 146 13.1 file and directory processing and operation 148 13.2.1 create and delete files and directories 148 13.2.2 obtain directory objects 149 13.3.3 copy and move files 149 13.2.4 file read and write 150 13.3 input/output stream 152 13.4 read binary data 152 write binary data 156 13.6 write text (character) 159 13.6.1 writer159 13.6.2 outputstreamwriter160 13.6.3 printwriter161 13.7 read text (character) 163 13.7.1 reader163 13.7.2 inputstreamreader163 13.7.3 bufferedreader165 13.8 use printstream to record logs 166 13.9 random access files 167 13.10 Object serialization 171 summary 13.11 exercises 173 Chapter 173 Nested classes and internal classes 14th 174 overview of Nested classes 14.1 14.2 static Nested classes 175 14.3 member Internal classes 176 local internal classes 14.4 178 anonymous internal classes 14.5 179 deep Nested classes and internal classes 14.6 180 summary 14.7 exercises 182 chapter 183 swing basics 15th 15.1 AWT component 185 15.2 useful AWT class 187 15.2.1 Java. AWT. color187 15.2.2 Java. AWT. font187 15.2.3 Java. AWT. point187 15.2.4 Java. AWT. dimension188 15.2.5 Java. AWT. rectangle188 15.2.6 Java. AWT. graphics188 15.2.7 Java. AWT. toolkit188 15.3 basic swing component 189 15.3.1 g015.3.2 Resize and positioning 192 15.3.3 extended 15.3.4 g015.3.5 icon and 15.3.6 g015.3.7 g015.3.8 jtextfield and 15.3.9 g015.3.10 jcheckbox202 15.3.11 g015.3.12 jlist205 15.3.13 jcombobox206 15.3.14 jdialog207 15.3.15 joptionpane210 15.3.16 jfilechooser214 15.4 summary 216 exercise 217 chapter 16th swing advanced knowledge 218 16.1 layout manager 218 16.1.1 10916.1.2 flowlayout221 16.1.3 boxlayout222 16.1.4 10916.1.5 no layoutmanager#16.2 event handling 225 16.2.1 Java event model 225 16.2.2 swing event processing 226 16.2.3 AWT event api228 16.3 use menu 239 16.4 appearance 240 16.5 Quick Start Screen 242 System Tray support 16.6 244 desktop assistant application 16.7 summary 246 exercise 16.8 250 chapter polymorphism 251 17.1 definition of polymorphism 251 17.2 polymorphism practice 254 17.3 plotting application in the polymorphism 254 17.4 259 polymorphism and reflection 17.5 261 Summary 261 exercises 18th chapter notes 262 18.1 annotations overview 262 18.1.1 annotations and annotations type 262 18.1.2 annotation syntax 263 18.1.3 annotation interface 263 18.2 standard annotation 264 18.2.1 11618.2.2 11618.2.3 11618.3 General annotation 267 18.4 standard yuan annotation 267 18.4.1 116ented267 18.4.2 11618.4.3 retention268 18.4.4 target268 18.5 custom Annotation 269 18.5.1 write your own custom annotation type 269 18.5.2 use custom annotation type 269 18.5.3 use reflection query annotation 270 18.6 271 conclusion 271 exercise 19th chapter 272 internationalization 19.1 locale272 19.2 application internationalization 274 19.2.1 text add the component to the property file 274 19.2.2 read the property file with resourcebundle 275 19.3 internationalize the swing application 275 19.4 summary 277 exercises 277 chapter 20th applet278 20.1 applet history 278 20.2 applet api279 20.2.1 Applet Class 279 20.2.2 appletcontext interface 281 route 2.3 audioclip interface 281 route 2.4 appletstub interface 282 Security Restriction 20.3 282 write and deploy applet282 20.4 appletviewer working principle 20.5 284 PASS Parameters to applet285 20.6 soundplayerapplet288 20.7 japplet289 20.8 in JAR File deploying applet290 20.10 faster loading 290 20.11 summary 291 exercises 291 chapter 21st Java Network 292 21.1 network overview 292 Hypertext Transfer Protocol (HTTP) 293 21.2.1 HTTP request 293 21.2.2 HTTP Response 294 21.3 java.net. url295 21.3.1 parse url295 21.3.2 read Web Resources 296 21.4 java.net. urlconnection297 21.4.1 read Web Resource 298 21.4.2 write data to Web Server 300 21.5 java.net. socket300 21.6 java.net. serversocket302 21.7 ONE Web Server application 303 21.7.1 httpserver class 303 21.7.2 request class 306 21.7.3 response class 308 21.7.4 run application 310 21.8 summary 311 exercises 311 chapter jdbc312 22nd JDBC introduction 22.1 Data Access step 4 313 22.2.1 load JDBC driver 313 22.2.2 obtain database connection 314 22.2.3 create statement object 315 22.2.4 create a resultset object 316 22.3 close JDBC object 317 22.4 read metadata 318 22.5 sqltool example 318 22.6 Summary 323 exercise 323 chapter 23rd Java thread 324 Java thread introduction 23.1 324 create thread 23.2 23.2.1 extended thread 324 23.2.2 implement runnable interface 326 327 use multithreading 23.3 327 thread priority 23.4 stop thread 329 23.6 synchronization 333 23.6.1 thread conflict 333 23.6.2 method synchronization 334 23.6.3 block synchronization 335 23.7 visibility 336 thread coordination 23.8 338 use timer342 23.9 swing timer344 23.10 summary 23.11 exercise 346 chapter 346 concurrency tool 24th 347 Atom variables 347 24.2 executor and executorservice348 24.3 callable and future351 24.4 swing worker354 24.5 lock 357 24.6 Summary 359 exercises 359 chapter 25th Security  Java security overview 25.1  use Security Manager 25.2 361 policy file 25.3 25.3.1 keystore363 25.3.2 grant363 25.4 permission 364 25.4.1 Java. io. filepermission365 25.4.2 Java. security. basicpermission365 25.4.3 Java. util. propertypermission365 25.4.4 java.net. socketpermission365 25.4.5 Java. security. unresolved-permission366 25.4.6 Java. lang. runtimepermission366 25.4.7 Java. AWT. awtpermission366 25.4.8 java.net. netpermission367 25.4.9 Java. lang. reflect. reflect-permission367 25.4.10 Java. io. serializable-permission367 25.4.11 Java. security. security-permission367 25.4.12 Java. security. allpermission367 25.4.13 javax. security. auth. auth-permission367 25.5 use policy tool368 25.6 applet Security 369 25.7 security programming 370 encryption overview 25.8 25.8.1 encryption/Decryption 370 25.8.2 verification 371 25.8.3 data integrity 372 25.8.4 SSL working principle 374 374 create certificate 25.9 keytool program 375 25.10.1 generate paired key 376 25.10.2 for authentication 377 25.10.3 import certificate to keystore 377 25.10.4 Export Certificate 378 25.10.5 list keystore entries 378 25.11 jarsigner tool 378 25.11.1 sign jar file 378 25.11.2 verify the signed JAR file 379 25.11.3 example: sign an applet379 25.12 Java Cryptography api382 25.13 summary 382 exercises 382 chapter 26th Java Web applications 383 26.1 servlet application architecture 383 26.2 servlet API overview 384 26.3 servlet385 26.4 write basic servlet applications 386 26.4.1 install tomcat386 26.4.2 compile and compile the servlet class 386 26.4.3 application directory structure 388 26.4.4 access servlet389 26.5 listen 26.6 then 26.7 then 26.8 then 26.9 then 26.10 HTTP servlet395 26.10.1 then 26.10.2 then 26.10.3 then 26.10.4 an HTTP servlet397 26.11 using deployment descriptor 401 26.12 summary 403 exercises 404 chapter 27th JavaServer pages405 27.1 JSP overview 405 27.2 jspinit, jspdestroy, and other methods 407 27.3 implicit object 408 27.4 JSP syntax element 409 27.4.1 Directive 409 27.4.2 script element 411 27.5 handling errors 413 27.6 summary 414 exercise 414 chapter 28th javadoc415 28.1 compiling documents in Java 416 28.1.1 @ author416 28.1.2 {@ code} 417 28.1.3 {@ docroot} 417 28.1.4 @ route 28.1.5 @ exception417 route {@ inheritdoc} 417 route {@ link} 418 route {@ linkplain} 418 route {@ literal} 418 28.1.10 @ param418 28.1.11 @ route 28.1.12 @ route 28.1.13 @ serial419 comment @ Comment comment @ comment 28.1.16 @ since420 28.1.17 @ throws420 comment {@ value} 420 comment @ version421 28.2 javadoc syntax 421 28.2.1 javadoc option 422 28.2.2 standard doclet option 423 28.2.3 generate document 28.3 Summary 425 exercise 425 chapter 29th Application Deployment 426 JWS overview 29.1 JNLP File Syntax 426 29.2.1 JNLP element 29.2 29.2.2 information element 426 29.2.3 security element 427 29.2.4 resources element 428 29.2.5 application-Desc element 429 29.2.6 applet-Desc element 429 deployment example 29.3 430 security concerns 29.4 432 summary 29.5 exercise 433 Appendix A javac434 appendix B java439 Appendix C jar444 appendix D netbeans448 Appendix E eclipse452 the book information comes from: china Interactive publishing network

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.