Skip to main content

Posts

Showing posts with the label java

Encapsulation in JAVA, a Brief explanation

It is a process of  wrapping   up  the  data members  along with related  data handlers method  is called  Encapsulation . Wrapping up the data members and data handlers method means we are grouping both as a single unit. In Java, we group or wrap both inside the Class, so Class is a single unit that consists of data members as well as methods. As shown in the figure. So, the class having both data members and related data handler method is called  Encapsulated Class. Here in the above definition, two important terms have been used i.e,  data members,  and  data handlers method. Data members:  The variables which are declared inside the class. Data handlers Method:  It is just a usual method, whose only purpose is to initialized or return the value of data members present inside the Class. Such types of methods do not use for writing any business logic or functionality.  #knowledgestreams.blogspot.com Types of Data Handler Method Getter Method:  It is used to return the value of  priva

EMPLOYEE MANAGEMENT SYSTEM PROJECT CODE

EMPLOYEE MANAGEMENT SYSTEM PROJECT CODE A - Below is the source code of the project. B - Create separate class files for every class. C - Copy the code of one class (ex: login.java) and paste it in Login class file, do it for every class . #stream #blog #knowledge 1 - Create your first class with name 'conn' and paste the code below in it  package Employeee; import java.sql.*; public class conn{        public Connection c;     public Statement s;     public conn(){         try{             Class.forName("com.mysql.jdbc.Driver");             c = DriverManager.getConnection("jdbc:mysql:///project3","root","");             s = c.createStatement();         }catch(Exception e) {             e.printStackTrace();         }     } }   2 - Create second class with name 'Login' and paste the code below in it package Employeee; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; cl