码迷,mamicode.com
首页 >  
搜索关键字:println    ( 5792个结果
字符统一转为小写
System.out.println(Character.toLowerCase('a')); System.out.println(Character.toLowerCase('A')); ...
分类:其他好文   时间:2019-03-20 15:55:24    阅读次数:131
Java中Math.random()的应用(随机生成数的应用)
<1>随即范围Java中a=Math.random()的取值范围为0<=a<=1由此可得a=Math.random()*n的取值范围是0<=a<=n<2>实际应用对于要求随机输出一个大写字母charss=(char)(int)(26*(Math.random())+65);//表示随机一个大写字母System.out.println(""+ss);对
分类:编程语言   时间:2019-03-19 21:48:49    阅读次数:195
实现我的第一个Java程序
第一步、打开记事本 第二步、代码编写 public class Hello{ public static void main( String[] args){ System.out.println("hello Java!"); System.out.println("开始我的Java生涯");}} ...
分类:编程语言   时间:2019-03-19 21:26:36    阅读次数:166
java printf println equals方法 StringBuffer类 数转换为字符
1.区别publicclassTest_toString{publicstaticvoidmain(String[]args){intm=47;System.out.printf("%d的十六进制数是%#X\n",m,m);System.out.println("m的十六进制数为"+Integer.toHexString(m).toUpperCase());System.out.printf("%
分类:编程语言   时间:2019-03-19 21:21:40    阅读次数:160
java初见
public class Diyi{ public static void main(String[] args){ System.out.println("Hello,world"); } } 运行结果 Hello,world 当我运行出结果时感觉非常厉害 今天主要学习内容有 1、Java相关知识 ...
分类:编程语言   时间:2019-03-19 20:15:15    阅读次数:155
循环结构 for
for格式:for(初始化表达式;循环条件表达式;循环后的操作表达式) { 执行语句:循环体 } 只要循环条件表达式运算的结果为boolean则for可以进行循环,如果循环条件表达式不是Boolean会提示类型错误 int a=1; for(System.out.println("a");a<3;S ...
分类:其他好文   时间:2019-03-19 01:33:35    阅读次数:118
循环结构 while,do while
while:先判断条件表达式是否成立,成立则执行循环体,不成立则不执行。 格式:while(条件表达式){ 执行语句(控制循环次数); } 例如: int x=1; while(x<3/*条件表达式*/){ System.out.println(x) x++;//(控制循环次数) } do whil ...
分类:其他好文   时间:2019-03-19 01:04:41    阅读次数:135
简单计算器与面积结合计算器
import java.util.Scanner;public class Study2 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("请输入运算种类 ...
分类:其他好文   时间:2019-03-18 19:54:26    阅读次数:317
设计模式(9)外观模式
我们每天上班回到家的时候都会做一系列的动作,像打开灯、打开电视和打开音响,用代码描述就如下一样。 public class Light { public void on() { System.out.println("打开了灯!"); } public void off() { System.out ...
分类:其他好文   时间:2019-03-18 00:59:10    阅读次数:156
java写出递归并完善
public class Test{ public static void main(String[] args){ System.out.println(method(5)); // 5 可以改成任何整数 } public static int method(int n){ if n<=1 // ...
分类:编程语言   时间:2019-03-17 22:58:39    阅读次数:132
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!