关于Java构造方法问题!请高手帮帮忙!

来源:百度知道 编辑:UC知道 时间:2024/04/28 19:48:01
package com.JavaSeries.Java.component;
import java.io.*;
import java.util.*;
import java.sql.*;
import java.text.*;
import com.JavaSeries.Java.component.Con_nect;
public class Personnel
{
public static void main(String args[])
throws IOException
{
Con_nect myData;
String pno,name,sex,birthday,department;

public Personnel()
throws SQLException , ClassNotFoundException
{
this.myData = new Con_nect();
}

public Personnel(String pno,String name,String sex,
String birthday,String departmnet)
throws SQLException, ClassNotFoundException
{
this.pno = pno;
this.name = name;
this.sex = sex;
this.birthday = birthday;
this.department = dapartment;
this.myData = new Con_nect(

在java中的构造方法准确点说叫"构造器",用来初始化成员对象.一个java类中可以有多个构造器,但其参数个数和类型都不一样,这叫做构造器的重载(overload)(注意不是覆盖(override)),目的是为了不同情形下的初始化."重载"和"覆盖"在面向对象的编程语言中是非常重要的概念,叫做"多态".我不知道你是不是想了解这些概念,还是......

典型的垃圾代码啊

ms不太好啊

你想问什么?-_-!

编程风格不太好
看看这个吧
http://bc.8tudou.cn

不明白。