Hi, i m making a national database program for practice.
in general package i have a class with gen infos like name dob etc.
now i want to create different packages for different departments like medical, insurance, license etc. so that i can include the gen infos in all the departments.
is it possible to make different packages for all departments and then extend it with the class from different packagee?
import java.util.Scanner; public class general { String name; String fname; int dob; char sex; public general() { this("no","no",0,'n'); } public general(String string, String string2, int i, char c) { // TODO Auto-generated constructor stub } protected void addgeninfo() { Scanner inp = new Scanner(System.in); System.out.println("Please Enter your name:"); name=inp.next(); System.out.println("Please Enter your Father's name:"); fname=inp.next(); System.out.println("Please Enter your dob(format:DDMMYYYY):"); dob=inp.nextInt(); String temp; System.out.println("Please Enter your sex(m/f):"); temp=inp.next(); sex =temp.charAt(0); } public static void main(String[] asgc) { //int totnationals=10; System.out.println("Welcome to National Database"); general nationals = new general(); nationals.addgeninfo(); } }
gv2sv.jpg