java完整程序代码 java 程序
求一个java程序代码
package Test1;
创新互联-专业网站定制、快速模板网站建设、高性价比淇县网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式淇县网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖淇县地区。费用合理售后完善,十多年实体公司更值得信赖。
import java.time.LocalDateTime;
import java.time.Month;
import java.util.IntSummaryStatistics;
import java.util.Scanner;
import java.util.Vector;
public class D {
static String s1 = "";
public static void main(String[] args) {
int day = LocalDateTime.now().getDayOfMonth();
Month month = LocalDateTime.now().getMonth();
int i = 1, i1 = 0;
VectorInteger vector=new Vector();
Scanner scanner = new Scanner(System.in);
while (i day + 1) {
System.out.println("请输入" + month + "月" + i + "日走的步数");
try {
i1 = scanner.nextInt();
} catch (Exception e) {
// TODO: handle exception
System.out.println("输入错误,请重新输入");
continue;
}
vector.add(i1);
i++;
}
scanner.close();
IntSummaryStatistics intSummaryStatistics=vector.stream().mapToInt(x-x).summaryStatistics();
int i2=intSummaryStatistics.getMax();
int i3=vector.indexOf(i2);
System.out.println(month+"月走的步数最多的日期为: "+(i3+1)+"号");
System.out.println("最多的步数为: "+i2);
}
}
Java求程序代码
按照你的要求编写的Java程序如下
import java.util.Scanner;
public class S{
public static void main(String[] args){
int n=5;
int[] a=new int[n];
System.out.print("请输入"+n+"个正整数:");
Scanner sc=new Scanner(System.in);
for(int i=0;in;i++){
a[i]=sc.nextInt();
}
System.out.print("其中的偶数为:");
for(int i=0;in;i++){
if(a[i]%2==0){
System.out.print(a[i]+" ");
}
}
}
}
编写一个的JAVA程序,求完整代码
public class Demo3 {
public static void main(String[] args) {
byte a =1;
short b=1;
int c = 1;
long d = 1l;
float e=1f;
double f =1;
char g ='1';
boolean h = true;
System.out.println("byte a ="+a);
System.out.println("short b="+b);
System.out.println("int c ="+c);
System.out.println("long d ="+d);
System.out.println("float e="+e);
System.out.println("double f ="+f);
System.out.println("char g ="+g);
System.out.println("boolean h ="+h);
int x=a%b;
long y = c+d;
boolean z=(b==c);
System.out.println("int x="+x);
System.out.println("long y"+y);
System.out.println("boolean z"+z);
}
}
当前标题:java完整程序代码 java 程序
网站网址:http://scyanting.com/article/dohopgs.html