我们都知道C语言有格式化输出printf()可以进行格式化输出这一功能,其格式如 printf("[%d %f]\n",x,y);其中d%、f%称为占位符,也叫做格式修饰符,他们说明了插入数据的位置也说明了将插入数据的类型(d表示整数,f表示浮点数)以及如何进行格式化。 <br> Java SE5之后推出了格式化输出功能,System.out.formart()可以用于PrintStream与PrintWriter对象。<br> 在java中所有新的格式化功能都是由java.util.Formatter类处理。 在java中如果需要控制输出字符串长度、空格已经对齐方式需要使用格式修饰符,其语法如下: %[argument_index$][flags][width][.precision]conversion
内容包含:目的;数据和它们的属性;创建数组;访问数组元素;修改数组元素。
说起Java,人们首先想到的是Java编程语言,然而事实上,Java是一种技术,它由四方面组成:Java编程语言、Java类文件格式、Java虚拟机和Java应用程序接口(JavaAPI)。它们的关系如下图所示:图1 Java四个方面的关系运行期环境代表着Java平台,开发人员编写Java代码(.java文件),然后将之编译成字节码(.class文件)。最后字节码被装入内存,一旦字节码进入虚拟机,它就会被解释器解释执行,或者是被即时代码发生器有选择的转换成机器码执行。从上图也可以看出Java平台由Java虚拟机和Java应用程序接口搭建,Java语言则是进入这个平台的通道,用Java语言编写并编译的程序可以运行在这个平台上。
第2讲Java编程基础Java的基本数据类型(重点)Java的关键字、标识符、常量、变量Java的运算符、表达式、语句Java程序的流程控制Java程序的基本结构及常用输入输出格式(重点)Java数组的声明、创建和使用(重点)教学目标熟悉Java的基本数据类型;熟悉Java的关键字、标识符的命名规则,掌握常量、变量的使用方法;熟悉Java的运算符,理解表达式、语句的构成;掌握Java程序的流程控制;熟悉Java程序的基本结构及常用输入输出格式;掌握Java数组的声明、创建和使用。
This authoritative study guide, including 250+ practice questions, will help you prepare for the Sun Certified Enterprise Architect for J2EE exam
This third edition covers Java 1.4 and contains 193 complete, practical examples: over 21,900 lines of densely commented, professionally written Java code, covering 20 distinct client-side and server-side APIs. It includes new chapters on the Java Sound API and the New I/O API. The chapters on XML and servlets have been rewritten to cover the latest versions of the specifications and to demonstrate best practices for Java 1.4. New and updated examples throughout the book demonstrate many other new Java features and APIs.
This book is a valuable reference for learning about regular expressions in Java, and focuses on the use of regular expressions in the Java language.
Java Primer Plus guides the reader through the Java programming language from the basic concepts (basic syntax, variable, literals, operators, loops, conditional statements, etc.) through advanced topics (RMI, JDBC, Network socket programming, etc.). It provides a deep explanation of Java programming concepts and technologies using classroom tested and proven techniques. What makes this book unique is that it spends the last part showing the reader how to integrate Java technologies into everyday Web related practices and with other technologies.
Nothing is as constant as change, and this is as true in enterprise computing as anywhere else. With the recent release of Java 2 Enterprise Edition 1.4, developers are being called on to add even greater, more complex levels of interconnectivity to their applications.<br> To do this, Java developers today need a clear understanding of how to apply the new APIs, use the latest open source Java tools, and learn the capabilities and pitfalls in Java 2 Enterprise Edition 1.4 -- so they can plan a technology and implementation strategy for new enterprise projects.
This book is a valuable reference for learning about regular expressions in Java, and focuses on the use of regular expressions in the Java language.
The J2EE Platform has become the technology of choice for developing professional e-commerce applications, interactive Web sites, and Web-enabled applications and services. Servlet and JSP(TM) technology is the foundation of this platform: it provides the link between Web clients and server-side applications. In this 2nd edition of the worldwide bestseller, the authors show you how to apply the latest servlet and JSP capabilities. Unlike other books that treat servlet or JSP technology in isolation, Core Servlets and JavaServer Pages provides a unified treatment, showing you when servlet technology is best, when the JSP approach is preferred, and when (and how) servlets and JSP should work together.
Two of the most significant technological development trends of the past few years have been the Java 2 Platform, Enterprise Edition (J2EE), a platform specifically geared to the needs of enterprise systems, and the Rational Unified Process (RUP), a comprehensive development methodology.<br> Building J2EE(TM) Applications with the Rational Unified Process is the first book to bring these two key development concepts together. Featuring a non-trivial sample application, the book demonstrates a customized subset of RUP that is relevant and essential to J2EE development. The text guides readers through the entire development process, from initial requirements gathering through system implementation, illuminating real-world intricacies, complications, tradeoffs, and decision making.
The first Internet revolution was all about delivering information to people. We are now in the second revolution, which focuses on delivering information to systems. XML is the tool that makes this new revolution a reality, and Web services are the methods by which businesses will drive system-to-system communication. JSP(TM) and XML takes you beyond the basics, giving you practical advice and in-depth coverage. In the book, you'll learn the technologies and techniques needed to create your own Web services for use in JSP applications. Written by programmers for programmers, the book will help you successfully utilize these exciting technologies with minimal hassle and maximum speed.
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.<br> 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).
单例对象(Singleton)是一种常用的设计模式。在Java应用中,单例对象能保证在一个JVM中,该对象只有一个实例存在。正是由于这个特点,单例对象通常作为程序中的存放配置信息的载体,因为它能保证其他对象读到一致的信息。例如在某个服务器程序中,该服务器的配置信息可能存放在数据库或文件中,这些配置数据由某个单例对象统一读取,服务进程中的其他对象要获取这些配置信息,只需访问该单例对象即可。
JSTL标签库的使用是为类弥补html表的不足,规范自定义标签的使用而诞生的。在告别modle1模式开发应用程序后,人们开始注重软件的分层设计,不希望在jsp页面中出现java逻辑代码,同时也由于自定义标签的开发难度较大和不利于技术标准化产生了自定义标签库。
一、JSP EL语言定义EL(Expression Language)目的:为了使JSP写起来更加简单。表达式语言的灵感来自于ECMAScript和XPath表达式语言,它提供了在JSP中简化表达式的方法。它是一种简单的语言,基于可用的命名空间(PageContext属性)、嵌套属性和对集合、操作符(算术型、关系型和逻辑型)的访问符、映射到Java类中静态方法的可扩展函数以及一组隐式对象。EL提供了在JSP脚本编制元素范围外使用运行时表达式的功能。脚本编制元素是指页面中能够用于在JSP文件中嵌入Java代码的元素。它们通常用于对象操作以及执行那些影响所生成内容的计算。
EL表达式规定为:eval-expression和 literal-expression,同时EL表达式支持Compositeexpressions,很多EL表达式(eval-expressions和 literal-expressions)被聚合在一起。 EL表达式被解析成数值表达式和方法表达式。其中,取值表达式去引用一个值,而方法表达式则是关联一个方法。一旦被解析之后,表达式能够被优化地计算一次或多次。
主要内容TCP协议Socket编程1UDP协议Socket编程2Socket编程实例3JavaMail邮件编程4Socket通讯网络上的两个程序通过一个双向的通讯连接实现数据的交换,这个双向链路的一端称为一个Socket。Socket通常用来实现客户方和服务方的连接。两类传输协议TCP(Transport Control Protocol)面向连接的能够提供可靠的流式数据传输的协议。类似于打电话的过程。URL,URLConnection,Socket,ServerSocket等类都使用TCP协议进行网络通讯。UDP(UserDatagramProtocol)非面向连接的提供不可靠的数据包式的数据传输的协议。
类概念现实世界:实体=属性+动作计算机世界:数据(信息):持久化编程世界:类是描述具有相同属性与动作的实体