⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 student.java

📁 J2EE 技术 源码 书籍源代码(j2ee编程技术)
💻 JAVA
字号:
/*
 * Created on 2004-6-15
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package com.jsp;

/**
 * @author haoyulong
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class Student {
	private long classno;
	private String name;
	private int age;
	private boolean sex;
	private String major;

	
	/**
	 * @return Returns the age.
	 */
	public int getAge() {
		return age;
	}
	/**
	 * @param age The age to set.
	 */
	public void setAge(int age) {
		this.age = age;
	}
	/**
	 * @return Returns the classno.
	 */
	public long getClassno() {
		return classno;
	}
	/**
	 * @param classno The classno to set.
	 */
	public void setClassno(long classno) {
		this.classno = classno;
	}
	/**
	 * @return Returns the major.
	 */
	public String getMajor() {
		return major;
	}
	/**
	 * @param major The major to set.
	 */
	public void setMajor(String major) {
		this.major = major;
	}
	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return Returns the sex.
	 */
	public boolean getSex() {
		return sex;
	}
	/**
	 * @param sex The sex to set.
	 */
	public void setSex(boolean sex) {
		this.sex = sex;
	}
	public Student(){
		//给变量赋初始值
		name="unknown";
		sex=true;
		age=20;
		major="computer";
		classno=1001;
	}
	public static void main(String[] args) 
	{
	System.out.println("test  JavaBean!");
	Student a=new Student();
    a.setAge(27);
    a.setClassno(1001);
    a.setName("mike");
    a.setSex(true);
    a.setMajor("computer");
    System.out.println("the name is "+a.getName());
    System.out.println("the major is "+a.getMajor());
    if(a.isSex())System.out.println("it is male");
    else System.out.println("it is female");
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -