下载此文档

JAVA代码.doc


文档分类:IT计算机 | 页数:约10页 举报非法文档有奖
1/10
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/10 下载此文档
文档列表 文档介绍
1. 扫描仪 Scanner import ; public class tests { public static void main( String [] args ){ Scanner in = new Scanner(System. in ); System. out .println( " 输入您的名字: " ); String name = in .next(); System. out .println( " 输出您的名字"+ name ); System. out .println( " 输入您的学号: " ); int num = in .nextInt(); System. out .println( " 输出您的学号"+ num ); System. out .println( " 输入您您最喜欢的字母: " ); String hehe = in .next(); System. out .println( " 输出您最喜欢的字母"+ hehe ); }} 2. Boolean 类型(判断真假) public class sqwjdv { public static void main(String[] args ){ int A =1; int B =2; boolean Q;Q=A == B; System. out .println( " 输出=" +Q ); } 3. 逻辑运算符 import ; public class tests { public static void main(String[] args ){ Scanner in = new Scanner(System. in ); System. out .println( " 输入您的 JAVa 成绩" ); int java = in .nextInt(); System. out .println( " 输入您的数学成绩" ); int math = in .nextInt(); if (!( java >85)&& math >90){ System. out .println( " 你好样的,帅哥" ); } System. out .println( " 测试" ); }} 4. if else 条件结构 import .*; public class tests { public static void main(String[] args ){ Scanner in = new Scanner(System. in ); System. out .println( " 输入您的数学成绩" ); int math = in .nextInt(); if ( math >=90){ System. out .println( " 你好样的,帅哥" ); } else { System. out .println( " 少玩" ); }}} 5. 多重 if 结构 else if import .*; public class tests { public static void main(String[] args ){ Scanner i

JAVA代码 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数10
  • 收藏数0 收藏
  • 顶次数0
  • 上传人012luyin
  • 文件大小0 KB
  • 时间2016-06-30