import java.io.*; public class Employee { public String name; private double salary; public Employee (String empName) { name = empName; } public Employee (double empSal) { salary = empSal; } public void printEmp() { System.out.println("name : " + name ); System.out.println("salary :" + salary); } public static void main(String args[]) { Employee empOne = new Employee("Ransika"); Employee emptwo = new Employee(1000); empOne.printEmp(); emptwo.printEmp(); } }
$javac Employee.java $java -Xmx128M -Xms16M Employee name : Ransika salary :0.0 name : null salary :1000.0
boolean
integer
string
null
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)