java 练习笔记

 /*熟悉数组的用法,并掌握引入外部函数1。*/
import java.util.Arrays; 
import java.util.Scanner;
public class array { 
           public static void main(String[] args) 
                { int a[] = {10,29,38,86,30,6,79};
                Arrays.sort(a);
                  //for(int i:a){
                System.out.print("最小的数是\n");
                     System.out.print(a[0]);
                     System.out.print("\n");
                     System.out.print("最大的数是\n");
                     System.out.print(a[6]);
//                 }
           }
}
/*2.了解java基本的输入输出方法*/
import java.util.Scanner;
public class area{
public static void main(String args[]){
	double p =3.1415926 ; 
	double r;  
	System.out.println("请输入半径");  
	Scanner s = new Scanner(System.in);  
//	Scanner t=new Scanner(System.in);
	r = Double.parseDouble(s.next());  
	System.out.println("圆的面积为"+p*r*r); 
	System.out.println("圆的周长为"+p*2*r);
	}
}


 


 

java 练习笔记,布布扣,bubuko.com

java 练习笔记

上一篇:python程序设计基础4:python函数设计和使用


下一篇:R.java was modified manually! Reverting to generated version!(R文件丢失异常原因汇总)