Java Programming
- 格式:pdf
- 大小:1.08 MB
- 文档页数:71
一、IntroductionJava programming language is one of the most widely used and popular programming languages in the world. Since its initial release in 1995, Java has g本人ned widespread adoption in various fields and industries, including web development, mobile application development, enterprise software development, and scientificputing. As a result, there is a large body of literature and reference materials av本人lable for Java programming, providing valuable insights, best practices, and solutions tomon challenges.二、Java Language SpecificationThe Java Language Specification (JLS) is the official reference guide for the Java programming language, providing a det本人led andprehensive overview of the language syntax, semantics, and core libraries. Written by the language designers themselves, the JLS serves as the authoritative source for understanding the intricacies of Java, including its object-oriented features, data types, control structures, and exception handling. The latest version of the JLS, for Java 17, is av本人lable online for free and is an essential resource for any serious Java programmer.三、Effective Java by Joshua BlochEffective Java, written by Joshua Bloch, is a widely accl本人med book that provides practical guidance and best practices for writing high-quality, efficient, and m本人nt本人nable Java code. The book covers a wide range of topics, including object creation, method design, concurrency, and serialization, offering valuable insights and rmendations based on Bloch's extensive experience as a Java architect at Sun Microsystems and Google. With its clear and concise explanations, as well as numerous code examples, Effective Java is an indispensable resource for both novice and experienced Java developers.四、Java Concurrency in Practice by Brian Goetz et al. Concurrency is a crucial aspect of modern software development, and Java provides powerful features for writing concurrent programs. Java Concurrency in Practice, authored by Brian Goetz and his colleagues, offers aprehensive and in-depth exploration of the Java platform's concurrency utilities, threading models, and best practices for writing concurrent and parallel code. The book also covers advanced topics such as synchronization, thread safety, and performance optimization, making it a valuable reference for developers working on multi-threaded applications.五、Head First Design Patterns by Eric Freeman et al.Design patterns are essential tools for tacklingmon software design challenges, and Head First Design Patterns presents an engaging and accessible introduction to the topic. Written by Eric Freeman, Elisabeth Robson, Bert Bates, and Kathy Sierra, the book uses a unique and interactive approach to convey fundamental design principles and a variety of design patterns in an easy-to-understand manner. With its visually rich and structured content, Head First Design Patterns is highly rmended for Java developers who want to improve their software design skills and apply proven solutions to recurring design problems.六、Java Performance: The Definitive Guide by Scott Oaks Performance optimization is a critical aspect of software development, particularly in the context of modern, resource-intensive applications. Java Performance: The Definitive Guide, authored by Scott Oaks, is aprehensive and authoritative resource for understanding, measuring, and improving the performance of Java applications. The book covers a wide range of topics, including JVM internals, garbage collection, profiling, and tuning, and provides practical guidance and real-worldexamples for achieving optimal performance in Java-based systems.七、ConclusionIn conclusion, the Java programming language offers a rich ecosystem of reference materials, books, and documentation to support developers in their Java programming journey. Whether it's mastering the language syntax and core libraries, adopting best practices for writing high-quality code, or delving into advanced topics such as concurrency, design patterns, and performance optimization, there are numerous resources av本人lable to cater to the diverse needs and interests of Java developers. By leveraging these reference materials, developers can enhance their skills, stay updated with the latest industry trends, and build robust and efficient software solutions using Java.。
DCWTechnology Analysis技术分析87数字通信世界2023.121 计算机软件Java编程概述在进行计算机软件研发时,需要编写软件程序,现阶段人们主要是应用编程语言编写软件程序,Java 编程语言凭借自身的优势被人们充分认可,获得软件研发者的高度好评。
从应用现状和应用效果来看,Java 编程语言与其他编程语言相比优势显著,具体体现在以下几个方面:第一,Java 编程语言适用于不同操作系统,符合系统对软件功能提出的各种要求;第二,Java 编程语言可以基于网络进行编写,这是V F 与V B 等编程语言所不具备的,因为这两种编程语言较为复杂,并且应用效果较差;第三,采用Java 编程语言让软件编程的每个环节都更加简单和便捷。
其稳定性和安全性较好,满足当下用户对于软件功能所提出的各种要求[1]。
2 计算机软件Java编程的特点2.1 分布性计算机软件Java 编程具有较强的分布性,其是一种分布式的语言,不仅可以支持不同层次网络的连接,也能够借助Socket 与流网络进行连接。
使用人员可以应用分布形式客户机与服务器,将网络作为软件应用期间的分布式运载工具[2]。
2.2 支持多线程Java 语言编程支持多线程。
具体来讲,所谓的多线程指的是程序内包含多个任务,这些任务实现了并行执行,大大提高了程序的运行效率。
Java 编程语言可以利用同步源语,实现源语的共享,可以对特定的行为进行有效操作,为交互性提供技术方面的保障。
计算机软件Java编程特点及技术分析袁琳琳(湖南汽车工程职业学院,湖南 株洲 412001)摘要:Java作为一门十分优秀和成熟的编程语言,被广泛应用到各个领域,备受大众的青睐。
Java编程语言有诸多优势,应用了多种技术,编程语言非常简单,也很安全和可靠。
文章介绍了计算机软件Java编程的概念与优势以及特点,分析了Java编程的关键技术及其应用策略,希望能为相关人员提供一些参考。
Java基础常见英语词汇(共70个) ['ɔbdʒekt]['ɔ:rientid]导向的['prəʊɡræmɪŋ]编程OO: object-oriented ,面向对象OOP: object-oriented programming,面向对象编程[dɪ'veləpmənt][kɪt]工具箱['vɜːtjʊəl]虚拟的JDK:Java development kit, java开发工具包JVM:java virtual machine ,java虚拟机['dʒɑːvə][mə'ʃiːn]机器[kəm'paɪl]Compile:编绎Run:运行['veərɪəb(ə)l] [ɒpə'reɪʃ(ə)n] [pə'ræmɪtə]variable:变量operation:操作,运算parameter:参数['fʌŋ(k)ʃ(ə)n]function:函数member-variable:成员变量member-function:成员函数[dɪ'fɔːlt] ['ækses] ['pækɪdʒ] [ɪm'pɔːt] ['stætɪk]default:默认access:访问package:包import:导入static:静态的[vɔid] ['peər(ə)nt] [beɪs] ['sjuːpə]void:无(返回类型) parent class:父类base class:基类super class:超类[tʃaɪld] [di'raivd] [əʊvə'raɪd] [əʊvə'ləʊd] child class:子类derived class:派生类override:重写,覆盖overload:重载['faɪn(ə)l] ['ɪmplɪm(ə)nts]final:最终的,不能改变的implements:实现[rʌn'taim] [æriθ'metik][ik'sepʃən]Runtime:运行时ArithmeticException:算术异常[ə'rei]['indeks] [baundz][ik'sepʃən] [nʌl] ['pɔintə]指针ArrayIndexOutOfBoundsException:数组下标越界异常Null Pointer Exception:空引用异常ClassNotFoundException:类没有发现异常['nʌmbə]['fɔ:mæt]NumberFormatException:数字格式异常(字符串不能转化为数字)[θrəuz]Throws: (投掷)表示强制异常处理Throwable:(可抛出的)表示所有异常类的祖先类[læŋ]['læŋɡwidʒ][ju'til] [,dis'plei] [ə'rei] [list]Lang:language,语言Util:工具Display:显示ArrayList:(数组列表)表示动态数组[hæʃ][mæp]HashMap: 散列表,哈希表[swiŋ] ['æbstrækt] ['windəu] ['tu:lkit]Swing:轻巧的Awt:abstract window toolkit:抽象窗口工具包[freim] ['pænl] ['leiaut] [skrəul] ['və:tikəl] Frame:窗体Panel:面板Layout:布局Scroll:滚动Vertical:垂直['hɔri'zɔntəl] ['leibl] [tekst] ['fi:ld]Horizontal:水平Label:标签TextField:文本框['εəriə] ['bʌtən] [tʃek] [bɔks]TextArea:文本域Button:按钮Checkbox:复选框['reidiəu] ['kɔmbəu] ['lisənə]Radiobutton:单选按钮Combobox:复选框Listener:监听['bɔ:də] [fləu] [ɡrid] ['menju:] [bɑ:]Border:边界Flow:流Grid:网格MenuBar:菜单栏['menju:] ['aitəm] ['pɔpʌp]Menu:菜单MenuItem:菜单项PopupMenu:弹出菜单['daiəlɔɡ] ['mesidʒ] ['aikɔn] [nəud]Dialog:对话框Message:消息Icon:图标Node:节点['dʒa:və]['deitəbeis] [,kɔnek'tivəti]Jdbc:java database connectivity :java数据库连接[draivə] ['mænidʒə] [kə'nekʃən] ['steitmənt]DriverManager:驱动管理器Connection:连接Statement:表示执行对象[pri'peəd] [ri'zʌlt]Preparedstatement:表示预执行对象Resultset:结果集['eksikju:t] ['kwiəri]executeQuery:执行查询Jbuilder中常用英文(共33个)[kləuz] [ik'sept] [peinz]Close all except…:除了..全部关闭Panes:面板组[bi:n] ['prɔpətiz] [meik] [bild] [,ri:'bild]Bean:豆子Properties:属性Make:编绎Build:编绎Rebuild:重编绎[ri'freʃ] ['prɔdʒekt] [di'fɔ:lt]Refresh:刷新Project properties:项目属性Default project properties:默认的项目属性[di:'bʌɡ] ['prefərənsiz] [kən'fiɡə] ['laibrəriz] Debug:调试Preferences:参数配置Configure:配置Libraries:库JSP中常用英文[,ju:ni'və:səl] [ri'sɔ:s] [ləu'keiʃən]URL: Universal Resource Location:统一资源定位符['intənet] [ik'splɔ:rə] ['dʒa:və] ['sə:və] [peidʒ]IE: Internet Explorer 因特网浏览器JSP: java server page:java服务器页面['mɔdəl] [kən'trəulə] ['tɔmkæt]Model:模型C:controller:控制器Tomcat:一种jsp的web服务器['mɔdju:l] ['sə:vlet][i'niʃəlaiz] ['sta:tʌp] WebModule:web模块Servlet:小服务程序Init: initialize,初始化Startup:启动['mæpiŋ][pə'ræmitə] ['seʃən] [,æpli'keiʃən] Mapping:映射Getparameter:获取参数Session:会话Application:应用程序['kɔntekst] [,ri:di'rekt] [dis'pætʃ] ['fɔ:wəd]Context:上下文redirect:重定向dispatch:分发forward:转交['ætribju:t] ['kɔntent] [taip]setattribute:设置属性getattribute:获取属性contentType:内容类型[tʃɑ:] [in'klu:d] [tæɡ][lib]charset:字符集include:包含tag:标签taglib:标签库[ik'spreʃən] ['læŋɡwidʒ][skəup] ['empti] EL:expression language,表达式语言Scope:作用域Empty:空['stændəd][tæɡ] ['laibrəri]JSTL:java standard tag library :java标准标签库[di'skripʃən] [kɔ:]TLD:taglib description,标签库描述符Core:核心Foreach:表示循环[va:(r)] ['vεəriəbl] ['steitəs] ['aitəm]Var:variable,变量Status:状态Items:项目集合['fɔ:mæt] [filtə]Fmt:format,格式化Filter:过滤器(报错英文['strʌktʃəz]Data Structures 基本数据结构['dikʃənəriz]Dictionaries 字典[prai'ɔrəti] [kju:z]Priority Queues 堆[ɡrɑ:f] ['deɪtə] ['strʌktʃəz]Graph Data Structures 图[set] ['deɪtə]['strʌktʃəz]Set Data Structures 集合[tri:s]Kd-Trees 线段树[nju:'merikəl] ['prɔ:bləms]Numerical Problems 数值问题[sɔlviŋ] ['liniə] [i'kweiʃənz]Solving Linear Equations 线性方程组['bændwidθ] [ri'dʌkʃən]Bandwidth Reduction 带宽压缩['meitriks] [,mʌltipli'keiʃən]Matrix Multiplication 矩阵乘法[di'tə:minənt] ['pə:mənənt]Determinants and Permanents 行列式[kən'streind] [ʌnkən'streɪnd] [,ɔptimai'zeiʃən]Constrained and Unconstrained Optimization 最值问题['liniə] ['prəuɡræmiŋ]Linear Programming 线性规划['rændəm] ['nʌmbə] [,dʒenə'reiʃən]Random Number Generation 随机数生成['fæktərɪŋ] [prai'mæləti] ['testɪŋ]Factoring and Primality Testing 因子分解/质数判定['ɑːbɪtrərɪ][prɪ'sɪʒən][ə'rɪθmətɪk]Arbitrary Precision Arithmetic 高精度计算['næpsæk] ['prɒbləm]Knapsack Problem 背包问题[dɪ'skriːt] ['fʊriər][træns'fɔːm]Discrete Fourier Transform 离散Fourier变换Combinatorial Problems 组合问题Median and Selection 中位数Generating Permutations 排列生成Generating Subsets 子集生成Generating Partitions 划分生成Generating Graphs 图的生成Calendrical Calculations 日期Job Scheduling 工程安排Satisfiability 可满足性Graph Problems -- polynomial 图论-多项式算法Connected Components 连通分支Topological Sorting 拓扑排序Minimum Spanning Tree 最小生成树Shortest Path 最短路径Transitive Closure and Reduction 传递闭包Matching 匹配Eulerian Cycle / Chinese Postman Euler回路/中国邮路Edge and Vertex Connectivity 割边/割点Network Flow 网络流Drawing Graphs Nicely 图的描绘Drawing Trees 树的描绘Planarity Detection and Embedding 平面性检测和嵌入Graph Problems -- hard 图论-NP问题Clique 最大团Independent Set 独立集Vertex Cover 点覆盖Traveling Salesman Problem 旅行商问题Hamiltonian Cycle Hamilton回路Graph Partition 图的划分Vertex Coloring 点染色Edge Coloring 边染色Graph Isomorphism 同构Steiner Tree Steiner树Feedback Edge/Vertex Set 最大无环子图Computational Geometry 计算几何Convex Hull 凸包Triangulation 三角剖分V oronoi Diagrams V oronoi图Nearest Neighbor Search 最近点对查询Range Search 范围查询Point Location 位置查询Intersection Detection 碰撞测试Bin Packing 装箱问题Medial-Axis Transformation 中轴变换Polygon Partitioning 多边形分割Simplifying Polygons 多边形化简Shape Similarity 相似多边形Motion Planning 运动规划Maintaining Line Arrangements 平面分割Minkowski Sum Minkowski和Set and String Problems 集合与串的问题Set Cover 集合覆盖Set Packing 集合配置String Matching 模式匹配Approximate String Matching 模糊匹配Text Compression 压缩Cryptography 密码Finite State Machine Minimization 有穷自动机简化Longest Common Substring 最长公共子串Shortest Common Superstring 最短公共父串DP——Dynamic Programming——动态规划recursion ——递归)报错英文第一章:JDK(Java Development Kit) java开发工具包JVM(Java Virtual Machine) java虚拟机Javac 编译命令java 解释命令Javadoc 生成java文档命令classpath 类路径Version 版本static 静态的String 字符串类JIT(just-in-time) 及时处理第二章:第三章:OOP object oriented programming 面向对象编程Object 对象Class 类Class member 类成员Class method 类方法Class variable 类变量Constructor 构造方法Package 包Import package 导入包第四章:Base class 基类Super class 超类Overloaded method 重载方法Overridden method 重写方法Public 公有Private 私有Protected 保护Static 静态Abstract 抽象Interface 接口Implements interface 实现接口第五章:RuntimeExcepiton 运行时异常ArithmeticException 算术异常IllegalArgumentException 非法数据异常ArrayIndexOutOfBoundsException 数组索引越界异常NullPointerException 空指针异常ClassNotFoundException 类无法加载异常(类不能找到)NumberFormatException 字符串到float类型转换异常(数字格式异常)IOException 输入输出异常FileNotFoundException 找不到文件异常EOFException 文件结束异常InterruptedException (线程)中断异常throws 投、掷、抛print Stack Trace() 打印堆栈信息get Message()获得错误消息get Cause()获得异常原因method 方法able 能够instance 实例Byte (字节类)Character (字符类)Integer(整型类)Long (长整型类)Float(浮点型类)Double (双精度类)Boolean(布尔类)Short (短整型类)Digit (数字)Letter (字母)Lower (小写)Upper (大写)Space (空格)Identifier (标识符)Start (开始)String (字符串)length (值)equals (等于)Ignore (忽略)compare (比较)sub (提取)concat (连接)trim (整理)Buffer (缓冲器)reverse (颠倒)delete (删除)append (添加)Interrupted (中断的)第七章:toString 转换为字符串GetInstance 获得实例Util 工具,龙套Components 成分,组成Next Int 下一个整数Gaussian 高斯ArrayList 对列LinkedList 链表Hash 无用信息,杂乱信号Map 地图Vector 向量,矢量Collection 收集Shuffle 混乱,洗牌RemoveFirst 移动至开头RemoveLast 移动至最后lastElement 最后的元素Capacity 容量,生产量Contains 包含,容纳InsertElementAt 插入元素在某一位置第八章:io->in out 输入/输出File 文件isFile 是文件isDirectory 是目录getPath 获取路径getAbsolutePath 获取绝对路径lastModified 最后修改日期Unicode 统一的字符编码标准, 采用双字节对字符进行编码FileInputStream 文件输入流FileOutputStream文件输出流IOException 输入输出异常fileobject 文件对象available 可获取的BufferedReader 缓冲区读取FileReader 文本文件读取BufferedWriter 缓冲区输出FileWriter 文本文件写出flush 清空close 关闭DataInputStream 二进制文件读取DataOutputStream二进制文件写出EOF 最后encoding 编码Remote 远程release 释放第九章:JBuider Java 集成开发环境(IDE)Enterprise 企业版Developer 开发版Foundation 基础版Messages 消息格Structure 结构窗格Project 工程Files 文件Source 源代码Design 设计History 历史Doc 文档File 文件Edit 编辑Search 查找Refactor 要素View 视图Run 运行Tools 工具Window 窗口Help 帮助Vector 矢量addElement 添加内容Project Winzard 工程向导Step 步骤Title 标题Description 描述Copyright 版权Company 公司Aptech Limited Aptech有限公司author 作者Back 后退Finish 完成version 版本Debug 调试New 新建ErrorInsight 调试第十章:JFrame 窗口框架JPanel 面板JScrollPane 滚动面板title 标题Dimension 尺寸Component 组件Swing JA V A轻量级组件getContentPane 得到内容面板LayoutManager 布局管理器setVerticalScrollBarPolicy 设置垂直滚动条策略AWT(Abstract Window Toolkit)抽象窗口工具包GUI (Graphical User Interface)图形用户界面VERTICAL_SCROLLEARAS_NEEDED 当内容大大面板出现滚动条VERTICAL_SOROLLEARAS_ALWAYS 显示滚动条VERTICAL_SOROLLEARAS_NEVER 不显示滚动条JLabel 标签Icon 图标image 图象LEFT 左对齐RIGHT 右对齐JTextField 单行文本getColumns 得到列数setLayout 设置布局BorderLayout 边框布局CENTER 居中对齐JTextArea 多行文本setFont 设置字体setHorizontalAlignment 设置文本水平对齐方式setDefaultCloseOperation 设置默认的关闭操作add 增加JButton 按钮JCheckBox 复选框JRadioButton单选按钮addItem 增加列表项getItemAt 得到位置的列表项getItemCount 得到列表项个数setRolloverIcon 当鼠标经过的图标setSelectedIcon 当选择按钮的图标getSelectedItem 得到选择的列表项getSelectedIndex 得到选择的索引ActionListener 按钮监听ActionEvent 按钮事件actionPerformed 按钮单击方法(编程词汇A2A integration A2A整合abstract 抽象的abstract base class (ABC)抽象基类abstract class 抽象类abstraction 抽象、抽象物、抽象性access 存取、访问access level访问级别access function 访问函数account 账户action 动作activate 激活active 活动的actual parameter 实参adapter 适配器add-in 插件address 地址address space 地址空间address-of operator 取地址操作符ADL (argument-dependent lookup)ADO(ActiveX Data Object)ActiveX数据对象advanced 高级的aggregation 聚合、聚集algorithm 算法alias 别名align 排列、对齐allocate 分配、配置allocator分配器、配置器angle bracket 尖括号annotation 注解、评注API (Application Programming Interface) 应用(程序)编程接口app domain (application domain)应用域application 应用、应用程序application framework 应用程序框架appearance 外观append 附加architecture 架构、体系结构archive file 归档文件、存档文件argument引数(传给函式的值)。
Java开发专业术语1. 概述Java是一种面向对象的编程语言,广泛应用于各个领域的软件开发中。
作为一名Java开发人员,了解和掌握Java开发专业术语是非常重要的。
本文将介绍一些常见的Java开发专业术语,包括语言特性、开发工具、框架和库等方面。
2. 语言特性2.1 面向对象Java是一种面向对象的编程语言,支持封装、继承和多态等面向对象的特性。
面向对象的编程思想可以使代码更加模块化、可维护和可扩展。
2.2 类和对象在Java中,类是对象的模板,用于定义对象的属性和行为。
对象是类的实例,可以通过new关键字创建。
类和对象是Java中最基本的概念之一。
2.3 继承继承是面向对象编程中的一个重要特性,允许一个类继承另一个类的属性和方法。
通过继承,可以实现代码的重用和扩展。
2.4 多态多态是指同一类型的对象在不同的情况下表现出不同的行为。
在Java中,多态可以通过继承和接口实现。
2.5 接口接口是一种抽象的数据类型,定义了一组方法的签名但没有具体的实现。
通过实现接口,可以使不同的类具备相同的行为。
2.6 异常处理Java提供了异常处理机制,可以捕获和处理程序运行过程中的异常。
通过使用try-catch语句块,可以使程序更加健壮和可靠。
3. 开发工具3.1 JDKJDK(Java Development Kit)是Java开发工具包的缩写,包含了Java编译器、运行时环境和开发工具等。
开发Java应用程序时需要安装和配置JDK。
3.2 IDEIDE(Integrated Development Environment)是集成开发环境的缩写,提供了代码编辑、编译、调试和部署等功能。
Eclipse和IntelliJ IDEA是常用的Java开发IDE。
3.3 MavenMaven是一个项目管理工具,可以自动化构建、测试和部署Java项目。
它使用POM (Project Object Model)来描述项目结构和依赖关系。
java编程常用英语词汇Java Programming Common English VocabularyJava is a popular programming language widely used for developing various applications and systems. As a programmer, it is essential to have a good understanding of the common English vocabulary used in the Java programming language. This article will introduce and explain frequently used Java programming terms in English.1. ClassIn Java, a class is a template or blueprint for creating objects. It defines the properties (variables) and functionalities (methods) of an object. Classes are used to create multiple objects that share similar characteristics.2. ObjectAn object is an instance of a class. It represents a real-world entity with its own set of properties and behaviors. Objects are created from a class and can interact with each other through methods.3. MethodA method is a set of instructions or code that performs a specific task. It is also known as a function in other programming languages. Methods are defined inside a class and can be reused and called multiple times throughout the program.4. VariableA variable is a named container used to store data in a program. It has a specific data type and can hold different values during the execution of the program. Variables provide a way to manipulate and reference data within the program.5. Data TypeIn Java, every variable has a data type that determines the type of data it can hold. The common data types in Java include integers (int), floating-point numbers (float, double), characters (char), booleans (boolean), and strings (String).6. LoopA loop is a control structure used to repeat a block of code multiple times. It allows the programmer to execute a set of statements repeatedly until a certain condition is met. The three main types of loops in Java are the for loop, while loop, and do-while loop.7. Conditional StatementA conditional statement is used to make decisions in a program based on certain conditions. It allows the program to execute different sets of instructions depending on the outcome of a condition. The if-else statement and switch statement are commonly used conditional statements in Java.8. InheritanceInheritance is a mechanism in Java that allows a class to inherit properties and methods from another class. It promotes code reusability and supports the concept of parent and child classes. Inheritance is implemented using the extends keyword in Java.9. PolymorphismPolymorphism allows objects of different classes to be treated as objects of a common superclass. It enables a single interface to be used for multiple implementations. Polymorphism in Java is achieved through method overriding and method overloading.10. Exception HandlingException handling is a mechanism used to catch and handle errors or exceptional situations that occur during program execution. It allows the programmer to handle errors gracefully and prevents the program from crashing. The try-catch block is used to handle exceptions in Java.11. InterfaceAn interface is a collection of abstract methods that define a contract for classes to implement. It specifies the behavior that a class should provide but does not provide any implementation details. To implement an interface, a class must use the implements keyword in Java.In conclusion, these are just a few of the many English vocabulary terms commonly used in Java programming. Mastering these terms will greatly enhance your understanding of the language and help you become a proficient Java programmer.。
Java_Programming_Final_Exam_Question_08W_PaperA 《J a v a程序设计》期末试题试卷(A)(考试形式:闭卷考试时间: 1.5⼩时)Total 8 pages《中⼭⼤学授予学⼠学位⼯作细则》第六条考试作弊不授予学⼠学位班级:___________ 姓名: ______学号:__________注意:答案⼀定要写在答卷中,写在本试题卷中不给分。
本试卷要和答卷⼀起交回。
Section 1. Choose the best answer 20 x 1 (mark each) = 20 marks1.In Java, arguments are always passed by ________.A. nameB. valueC. pointerD. array2.In Java, we can define multiple methods with the same name. This is called _____.A. method overridingB. This is not allowedC. method overloadingD. method hiding3.Which type of objects are immutable?B.StringBufferStringA.C. char [] stringD.int [] s14. A thread’s entry point is its method.run.B.A.start.E. distroy5.Given any URL object urlobj, which method can be used to retrieve its constitute parts? urlobj.getHost()B.A.urlobj.Method.urlobj.openStream()D.C.urlobj.start()6.The best way to peform custom painting is to override ____?A.repaint()B.paintComponent()C.update()D.paint()E.other method7.Which one can be used for an event source to register a listener?A. actionPerformed.B. addActionListener()C. ActionListenerD. MouseAdapter8.Which is not a benefit of encapsulation?A.Clarity of code.B.Code efficiency.C.The ability of add functionality later onD.Modifications require fewer coding changes9.OutputStreamWriter is a subclass of _ ?A.ReaderB.OutptuStreamC.PrintWriterD.BufferedWriterE.Writer10.Which one cannot help achieve plug compatibility in Java program?A.Synchronized Method.C.Access only uniform public interfaceD.Run-time method overriding11.A compile error occurs ifA.A static method in a subclass has the same signature with a static method in superclass.B. A subclass static method has the same signature as asuperclass instance method.C. A subclass field has the same name as a field used in a superclassD.Appendant member calls a method in superclassE. A superclass has a protected member12.Which of the following is a component of an event handling model?A. object registryB. proxyC. event listenerD. web client13.The GUI program execution envitonment does not suppliesA. event monitoringB. input focusingC. window renderingD. creating a POST query14.Which statement is true about wrapper or String classes?A.if x and y refer to instances of different wrapper classes, then the fragment x.equals(y) will cause a compiler failure.B.If x and y refer to instances of different wrapper classes, then x == y can sometimes be true.C.If x and y are String references and if x.equals(y) is true, then x == y is true.D.If x, y and z refer to instances of wrapper classes and x.equals(y) is true and y.equals(z) is true, then z.equals(x) will be always true.E.If x and y are String references and x == y is true, but y.equals(x) will not be true.15.Which of the following does not concern with a method signature?A.Method name.B.The number of its formal parameters.C.The order of its formal parametersD.The types of its formal parametersE.The return type16.Which statement is true?garbage collector.B.Objects with at least one reference will never be garbage collected.C.Objects from a class with the finalize() method overridden will never be garbage collected.D.Objects instantiated within anonymous inner classes are placed in the garbage collectible heap.E.Once an overridden finalize() method is invoked, there is no way to make that object ineligible for garbage collection.17.A reference variable can ?A.Hold the constant value 546B.Can be a primitive typeC.Be an array variableD.Be converted to a primitive typeE.Hold a reference to an object18.Which one of the layout can be used to arrange the components in specified rows and columns?A.FlowLayoutB.GridLayoutC.BorderLayoutD.CardLayout19.In a Java interfaceA.members can be public or privateB.All members are abstractC.Fields can be final or instanceD.Methods must be implemented20.Which method is not supplied by a URL objectA.Methods to parse the URLB.paint()C.Methods to open network connectionD.Method to retrieve information1. A dead thread can be restarted.2. Java objects are always created with new operation.3. In Java, a class can extend at most one superclass and can implemen at mostone interface.5. A thread is in the ready state after it has been created and started6. The main() method takes an argument of the String[ ].7. A double value can be cast to a byte.8. Window, Frame, Dialog, FileDialog, Panel, Applet are not container classes –False9. In Java, a class is implicitly of any superinterfave type.10. The Java overriding mechanism ensures that the calls on methods in superclass and subclass invoke the appropriate overriding methods.Section 3. Answer the Following Questions 5 x 4 (mark each) = 20 marks1. What operations will be performed when a thread calls a synchronized instance method?2. How is the method call resolution performed by Java compiler when a call is made to an overloaded method in class extension?3. What is plug-compatible object? What is polymorphism?4. In the event-handling model, what is an event source? An event listener? An event client? An event object?5. To program an Internet client using stream socket to access TCP-based server, what things you should do in your program?1. In GUI program, if you want to have a JPanel custom painting, you usually override method ____2. To add a byte buffer to a FileInputStream stream, you use _______________3. In Java, every object and class can potentially function as a ___________ anda monitor.4. In Java, the event-handling model describes how to represent, how to report, and how to ___________the events.5. A constructor can also call another constructor in its own class to help perform initializations. This can be done by calling __________6. The same identifier can be used in ________name spaces without conflict.7. It is a compile-time error if a subclass instance method has the same signature as___________________.8. In Java, a class with no declared superclass implicitly extends ____________.9. Run-time overriding is one of the conditions to help the polymorphic transfer in achieving ______________.10. The main advantage of an interface over an abstract class is thatSection 5. Write the output for the following programs 5 x 2 (mark each) = 10 marks 1. Given the following, public class runtimexceptiondemo {public static void throwit() {“);System.out.print(“throwitthrowRuntimeException();new}public static void main(String args[ ]) {try {System.out.print(“hello“);throwit();e){}catch(Exception“);System.out.print(“caughtfinally {}“);System.out.print(“finally}“);System.out.print(“after}}2. Given the following,public class switchdemo {final static short x = 2;public static int y = 0;for(int z = 0; z < 3; z++) {switch(z) {“);System.out.print(“0x:case“);System.out.print(“1x-1:case“);System.out.print(“2casex-2:}}}}class MyThread extends Thread { {MyThread() MyThread”);System.out.print(“}{run()publicvoidbar”);System.out.print(“}public void run(String s) { baz”);System.out.println(“public class TestThreads {public static void main(String [ ] args) { Thread t = new MyThread() {{publicrun()voidfoo”); System.out.print(“}};t.start();}}4. Given the following,public class commandargs {public static void main(String args[ ]) { args[1];=s1Stringargs[2];=s2Stringargs[3];=s3Stringargs[4];=s4StringSystem.out.print(“ args[2] = “ + s2);And the command line invocation, as java commandargs 1 2 3 4class test {ints;staticpublic static void main(String args[]) { new=test();testpp.start();System.out.println(s);}{voidstart()7;=xInttwice(x);“);“+System.out.print(x}void twice(int x) {x*2;x=s = x;Section 6. Programming 3 x10 (mark each) = 30 marks1.Write an applet that displays “over” when the mouse is over its display area and displays“leave” when the mouse leaves the area.2.Write a class for a mutual exclusion object in which the reading and the writing of aninternal integer X are synchronized.3.Define a base class for just displaying an integer in the screen. Then extend this baseclass to obtain a class for displaying a float number in the screen. Write a polymorphic program to demonstrate the interchangable objects of these two classes.。
Java (programming language)From Wikipedia,the free encyclopediaJava is a programming language originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation)and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low—level facilities. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM)regardless of computer architecture. Java is a general-purpose,concurrent,class-based,object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere," meaning that code that runs on one platform does not need to be edited to run on another. Java is currently one of the most popular programming languages in use, particularly for client—server web applications,with a reported 10 million users.[10][11] The original and reference implementation Java compilers,virtual machines, and class libraries were developed by Sun from 1995。