微软用户-第2讲基本数据类型与表达式.ppt

微软用户-第2讲基本数据类型与表达式.ppt

第2讲 基本数据类型与表达式;目标;引例;已知三角形的三条边,计算它的周长与面积。;//文件名Ex2_1.java import java.io.*; public class Ex2_1 { public static void main (String[] args) { int a,b,c,p; float area; a=8; b=5; c=10; p=a+b+c; area=(float)Math.sqrt((p-a)*(p-b)*(p-c)*p/2); System.out.println(The length of three side is+a+,+b+,+c); System.out.println(The sides of triangle is:+p); System.out.println(The area of triangle is:+area); } };标识符;关键字;Java基本数据类型;数值型(一);数值型(二);字符型;布尔型;常量;字符常量;final 数据类型 常量名称=常量值;;public clas

文档评论(0)

1亿VIP精品文档

相关文档