Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Has A
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { Address addr1 = new Address("Hà Nội","133"); Address addr2 = new Address("HCM","266"); Employee emp1 = new Employee ("Minh",14, addr1); Employee emp2 = new Employee ("Mạnh", 14, addr2); emp1.display(); emp2.display(); } } class Address { String city; String street; public Address(String city, String street) { this.city = city; this.street = street; } } class Employee { String name; int age; Address address; public Employee (String name, int age, Address address){ this.name = name; this.age = age; this.address = address; } public void display() { System.out.println (name+" "+age+" "+address); System.out.println (address.city+" "+address.street); } }
run
|
edit
|
history
|
help
0
JAVA regex for only allow numbers
Java
Prime Numbers
Queue implementation
NumberBasedAlphabetsPrint
Java Class and Object
Kochergina_2
log
Complex number multiplication (leetcode)
Class multiple