Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
public class Person { private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return "Name: " + name +", Age: " +age; } } public class Employee extends Person{ private String position; private double salary; public Employee(String name, int age, String position, double salary) { super(name, age); this.position = position; this.salary = salary; } public Employee(String name,String position){ super(name,18); this.position = position; this.salary = 0; } @Override public String toString() { return super.toString() + ", Position: " + position + ", Salary: " + salary; } } public class Test { public static void main(String[] args) { Employee emp1 = new Employee("Alice", 25, "Manager", 50000); Employee emp2 = new Employee("Yerke", "Intern"); System.out.println(emp1); System.out.println(emp2); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)