标签:
package com.homework.zw; //student类部分 public class Student { int stuNo; String name; int age; void output() { System.out.println("学号:"+stuNo); System.out.println("姓名:"+name); System.out.println("年龄:"+age); } } package com.homework.zw; //主类textClass部分 import java.util.Scanner; public class TexeClass { public static void main(String[] args) { Student stu = new Student(); Scanner sc = new Scanner(System.in); Scanner sc1 = new Scanner(System.in); System.out.println("请输入学号:"); stu.stuNo=sc.nextInt(); System.out.println("请输入姓名:"); stu.name=sc1.nextLine(); System.out.println("请输入年龄:"); stu.age=sc.nextInt(); stu.output(); } }
标签:
原文地址:http://www.cnblogs.com/HRZJ/p/5877982.html