- 博客(16)
- 收藏
- 关注
原创 递归知识点
递归package method;public class Demo05 { public static void main(String[] args) { System.out.println (f(5)); } public static int f(int n){ if (n==1){ return 1; }else { return n*f(n-1); .
2022-03-13 17:51:00
73
原创 方法的定义和调用
1、2、3、package metho;public class Demo02 { public static void main(String[] args) { int max = max(10,20); System.out.println(max);//方法的调用 } //比大小 public static int max(int num1,int num2){ int result..
2022-03-13 16:53:44
41
原创 break continue
1、package struct;public class BreakDemo { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if (i==30){ break; }
2022-03-12 18:57:38
40
原创 for 循环
1、package struct;public class ForDemo01 { public static void main(String[] args) { int a = 1;//初始化条件 while (a<=100){//条件判断 System.out.println(a);//循环体 a+=2;//迭代 } System.out.println("whil
2022-03-12 18:56:26
46
原创 do while
package struct;public class DoWhileDemo01 { public static void main(String[] args) { int i = 0; int sum = 0; do { sum = sum + i; i++; }while (i<=100); System.out.println(sum); }.
2022-03-11 18:02:00
43
原创 while循环
1、package struct;public class WhileDemo01 { public static void main(String[] args) { //输出1-100 int i = 0; while (i<100){ i++; System.out.println(i); } }}2、package stru...
2022-03-11 17:41:24
41
原创 Switch 选择结构
1、package struct;public class SwitchDemo01 { public static void main(String[] args) { //case穿透 char grade = 'C'; switch (grade) { case 'A': System.out.println("优秀"); break;//可选
2022-03-11 16:21:47
31
原创 if选择结构
1、package struct;import java.util.Scanner;public class IfDemo01 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.nextLine(); //equals: 判断字符串是否相等 if (s.equals(
2022-03-11 11:39:35
60
原创 Scanner 学习
一、package scanner;import java.util.Scanner;public class Demo01 { public static void main(String[] args) { //创建一个扫描器的对象,用于接收键盘数据 Scanner scanner =new Scanner(System.in); System.out.println("使用next方式接收"); //判断用户有没
2022-03-01 19:14:43
68
原创 变量、常量、作用域
public class demo7 { //类变量 static static double salary = 2500; //属性:变量 //实例变量:从属于对象;如果不自行初始化,这个类型的默认值 0 0.0 u0000 //布尔值:默认是false //除了基本类型,其余的默认值都是null; String name; int age; //main 方法 public static void main(S.
2022-02-28 18:29:07
41
原创 java基础知识 类型转换
public class demo5 { public static void main(String[] args) { int i = 128; byte b = (byte) i ;//内存溢出 double c= i; //强制转换 (类型)变量名 高--低 //自动转换 低--高 System.out.println(i); System.out.println(b.
2022-02-28 16:56:15
46
原创 数据类型--------
public class demo3 { public static void main(String[] args) { //整数扩展: 进制 二进制0b 十进制 八进制0 十六进制0x int i = 10 ; int i2 = 010; int i3 = 0x10; System.out.println(i); System.out.println(i2); .
2022-02-28 16:26:46
35
原创 Hello World
HelloWorld1.随便新建一个文件夹,存放代码2.新建一分java文件 文件后缀名为 .java Hello.java [注意]系统可能没有显示文件后缀名,需手动打开 3.编写代码public class Hello{ public static void main(String[] args){ System.out.print("Hello,world!"); }}4.编译javac java文件,...
2022-02-27 10:58:02
120
原创 计算机快捷键
Ctrl+C : 复制Ctrl+V : 粘贴Ctrl+A : 全选Ctrl+X : 剪切Ctrl+Z : 撤销Ctrl+S: 保存Alt+F4: 关闭窗口Shift+Delete : 永久删除win+R :打开命令窗口win+E: 打开我的电脑Ctrl + Shift + Esc :打开任务管理器win+ tab : 切换窗口...
2022-02-26 16:10:26
106
原创 Mark Down
Mark Down学习标题一级标题二级标题三级标题字体hello world粗体hello world斜体hello world粗和斜hello world删除引用学习JAVA 努力走向成功分割线图片![图片名字](输入图片地址)超链接点击跳转到百度列表 A B C 有序 A B C 无序 表格名字 性别 生日 张三
2022-02-26 12:12:27
195
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人