Building Blocks

所需积分/C币:15 2013-11-08 18:09:04 1.22MB PDF
收藏 收藏

Sample Class Test Question If a Java source file contains a single minor syntax error what will happen? (a the compiler will display an error message and then generate a tile containing byte code (b The compiler will stop without displaying an error message (c The compiler will display an error message (d The compiler will correct the error and then generate byte code Lecture Topics Program Structure Literals Expressions Arithmetic Operators Variables Assignment 」 ava Data Types A Complete Java Program public class OnePlusone public static void main (string[] args) System. out. print"value of 1+1 System. out. println(1+1) Running OnePlusone Console output for the program is shown below G: Command Prompt M: \Java 1> java OnePlus One Value of 1+1 is 2 M: \Java 1 The arithmetic expression is evaluated and the result is then displayed on the console Structure of a Java Application //Class declaration public class className // Definition of main method public static void main(string[] args) Program statements Analysing the Program The class contains a method called maino) Method consists of two statements System, out. print("Value of 1+1 is") System. out. println(1+1)i These two statements contain Class, field and method names a string literal An arithmetic expression involving integer literals Literals A literal is the source code representation of a fixed value Integer literals 9990 33400000000L ORABC (Hexadecimal -0x Prefix) 010 (○cta- Zero prefi×) Floating point literals 999.0 12.34p Literals String literals > Java is an object oriented language Character literals A 9 Boolean literals 七uefa1se

试读 45P Building Blocks
立即下载 低至0.43元/次 身份认证VIP会员低至7折
leehost 提高一下JAVA
WizardtoH 最近学java,可以看看
关注 私信 TA的资源
Building Blocks 15积分/C币 立即下载
Building Blocks第1页
Building Blocks第2页
Building Blocks第3页
Building Blocks第4页
Building Blocks第5页
Building Blocks第6页
Building Blocks第7页
Building Blocks第8页
Building Blocks第9页

试读结束, 可继续读5页

15积分/C币 立即下载 >