eclipse 的输入输出练习

    public void main(String[]args){                    

                        //实例化输入扫描器
            //System.in 输入流
            Scanner sc = new Scanner(System.in);
            
            System.out.print("请输入名称:");
            //等待输入
            String strin =sc.nextLine();
            
            // 输出接收的内容
        System.out.println("你输入的名称是:" + strin);           }                                     

2.输入圆的半径,计算圆的周长和面积

package com.hanqi.practice;

import java.util.Scanner;

public class Cirtle {

    public static void main(String[] args) {
        // TODO 自动生成的方法存根
        Scanner sc =new Scanner (System.in);
        final double PI =3.14;
        System.out.println("请输入半径的大小");
        int r =sc.nextInt();
        System.out.println("圆的周长为:"+2*PI*r);
        System.out.println("圆的面积为:"+PI*r*r);
    }

}

输出结果

看到她们快乐的晒,我就放心了,我要去炼淬了
原文地址:https://www.cnblogs.com/miracle-0807/p/5864278.html