自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 统计大串中小串出现的次数

package 项目四;//在字符串中//“woaijavawozhenaijavawozhendeaijavawozhendehenaijavaxinbuxinwoaijavagun”中java出现了5次。public class 项目四 { public static void main(String[] args) { // TODO Auto-generated method stub String a = "woaijavawozhenaijavawozhendeaijava

2020-12-08 15:13:54 236 1

原创 统计一个字符串中大写字母字符,小写字母字符,数字字符出现的次数

package 项目五; import java.util.Scanner;public class 项目五 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); System.out.println("请输入字符串: "); String Line = sc .nextLine();

2020-12-08 15:12:03 387

原创 模拟登录,给三次机会,并提示还有几次

package 项目六;import java.util.Scanner;public class 项目六 { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("欢迎登陆该系统"); Scanner sc = new Scanner(System.in); System.out.println("请输入数字,有三次机会"); for(i

2020-12-08 15:11:18 384

原创 数组遍历(依次输出数组中的每一个元素)。 例如:int a = {2,0,2,0};在控制台输出 {2,0,2,0}

public class shuzu { public static void main(String[] args) { // TODO Auto-generated method stub int [] a = {2,0,2,0}; int i = 0; System.out.print("["); for (i=0;i<=3;i++){ System.out.print(a[i]); if(i<3){ System.out.prin

2020-12-04 20:55:11 2553

原创 将’A’,’B’,’C’存入数组,然后再输出

public class ABC { public static void main(String[] args) { // TODO Auto-generated method stub String [] a = new String [3]; a[0]="A"; a[1]="B"; a[2]="C"; for(int i = 0; i<3;i++){ System.out.println(a[i]); } }}

2020-12-04 20:54:40 1288

原创 请将”我” “爱” “Java”存入数组,然后正着和反着输出

public class java { public static void main(String[] args) { // TODO Auto-generated method stub String [] a = new String [3]; a[0] = "我"; a[1] = "爱"; a[2] = "java"; for(int i = 0; i<a.length;i++){ System.out.print(a[i]); } Syste

2020-12-04 20:54:09 1409

原创 输入10个整数存入数组,然后复制到b数组中输出

public class 十个数 { public static void main(String[] args) { // TODO Auto-generated method stub int [] a = {1,5,6,8,4,3,8,2,6,7}; int [] b = new int [10]; System.out.print("{"); for (int c = 0; c<a.length; c++) { System.out.print(a[c]

2020-12-04 20:53:38 4274

原创 定义一个Student类,成员变量有姓名、年龄;用数组存5个学生对象,并输出

public class Student { String name; int age; public Student(String name,int age) { this.name=name; this.age=age; } }public class text { public static void main(String[] args) { // TODO Auto-generated method stub Student[] a = ne

2020-12-04 20:52:53 6989

原创 对下列数字进行排序 3 1 6 2 9 0 7 4 5 8

public class 排序 { public static void main(String[] args) { // TODO Auto-generated method stub int [] arr = {3,1,6,2,9,0,7,4,5,8}; for(int i = 0;i<arr.length-1;i++) { for(int l = 0;l<arr.length-i-1;l++) { if(arr[l+1]>arr[l]) { i

2020-12-04 20:51:58 644

原创 数组元素查找(查找指定元素第一次在数组中出现的索引)

public class 查找 { public static void main(String[] args) { // TODO Auto-generated method stub int [] arr = {2,5,4,6,8,4,1,3,7,5}; int b = 6; for(int i = 0; i<arr.length;i++) { if(arr[i]==b) { System.out.println(i); } } }}

2020-12-04 20:51:15 1027

原创 数组获取最值(获取数组中的最大值最小值)

public class 最值 { public static void main(String[] args) { // TODO Auto-generated method stub int [] a = {3,5,9,4}; int max = 0; for (int f = 0; f<a.length;f++) { if (a[f]>max) { max=a[f]; } } System.out.prin

2020-12-04 20:50:34 642

原创 输入行数,打印相应的杨辉三角

package 三角型;public class 三角形 { public static void main(String[] args) { // TODO Auto-generated method stub int [] [] arr = new int [6] [] ; //控制行数 for(int i = 0 ; i<6;i++){ arr[i]=new int[i+1]; for(int j = 0 ; j<arr.length-i;

2020-12-03 18:51:18 494

原创 将字符串的首字母转换为大写,其余转换为小写

package 大小;public class 大小 { public static void main(String[] args) { // TODO Auto-generated method stub String arr = "hello"; for(int i = 0; i<arr.length();i++) { //遍历字符串 if(i<=0) { char a =(char) (arr.charAt(i)-32); //字符串第一个字符变成大写

2020-12-03 18:46:35 812

原创 遍历获取字符串中的每一个字符

package 字符;public class 字符 {public static void main(String[] args) { // TODO Auto-generated method stub String arr = "java"; for(int i = 0; i<arr.length();i++) { //遍历字符串的每个字符 System.out.println(arr.charAt(i)); }}}...

2020-12-03 18:43:57 4089

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除