Skip to main content

Posts

Showing posts with the label Java

Hire Me app for Android

Java - Classes and Objects Example

Employee.java //Employee Class (Base class) public class Employee { int Empno; String name; String telephone; double basicsalar; double othrs; double otrate; double netSal; public double calcNetSalary(){ return basicsalar + othrs * otrate; } public void displayNetSalary() { netSal = basicsalar + othrs * otrate; System.out.println("Net Salary: "+netSal); } //Set name public void setName(String name) { this.name = name; } //Set telephone public void setTelephone(String telephone) { this.telephone = telephone; } //Set Empno public void setEmpno(int Empno) { this.Empno = Empno; } //Set OT hours public void setOthrs(double othrs) { this.othrs = othrs; } //Set OT Rate public void setOtrate(double otrate) { this.otrate = otrate; } //Set OT Rate public void setBasicsalar(double basicsalar) { this.basicsalar = basicsalar; } } Manager.java //Manager Class public class Manager extends Employee {

JAVA Hello World Samples

Java • 1991 - James Gosling, Sun Microsystems, Inc. • Originally a platform independent language for programming home appliances and was called “Oak” later renamed “Java” in 1995. • Later (1994) used for World Wide Web applications (since byte code can be downloaded and run without compiling it) • Eventually used as a general-purpose programming language (for the same reason as above plus it is object-oriented) • Why the name “Java”? Java was then named “Java”, paying homage to the large amounts of coffee consumed by the team. • Now owns by Oracle • Full-fledged application programming language • Additional capability as a Web programming language (currently the strength of its application base) • A pure OO programming language • NOT radical or especially new • Adopts its looks from C++, and its behavior from Smalltalk • Compiled to processor-neutral instruction set then interpreted on each supporting platform • Extremely fast adoption rate! (d