public class Test {
public static void main(String[] args) throws ClassNotFoundException {
Bread bread1 = new Bread();
Bread bread2 = new Bread();
}
}
class Bread {
static{
System.out.println("Bread is loaded");
}
public Bread() {
System.out.println("bread");
}
}
public class Test {
public static void main(String[] args) {
new Meal();
}
}
class Meal {
public Meal() {
System.out.println("meal");
}
Bread bread = new Bread();
}
class Bread {
public Bread() {
System.out.println("bread");
}
}
class Person {
public Person() {
}
}
class Man extends Person {
public Man() {
}
}
class Shape {
protected String name;
public Shape(){
name = "shape";
}
public Shape(String name) {
this.name = name;
}
}
class Circle extends Shape {
private double radius;
public Circle() {
radius = 0;
}
public Circle(double radius) {
this.radius = radius;
}
public Circle(double radius,String name) {
this.radius = radius;
this.name = name;
}
}
public class Test {
public static void main(String[] args) {
new Circle();
}
}
class Draw {
public Draw(String type) {
System.out.println(type+" draw constructor");
}
}
class Shape {
private Draw draw = new Draw("shape");
public Shape(){
System.out.println("shape constructor");
}
}
class Circle extends Shape {
private Draw draw = new Draw("circle");
public Circle() {
System.out.println("circle constructor");
}
}
shape draw constructor
shape constructor
circle draw constructor
circle constructor
public class Test {
public static void main(String[] args) {
Shape shape = new Circle();
System.out.println(shape.name);
shape.printType();
shape.printName();
}
}
class Shape {
public String name = "shape";
public Shape(){
System.out.println("shape constructor");
}
public void printType() {
System.out.println("this is shape");
}
public static void printName() {
System.out.println("shape");
}
}
class Circle extends Shape {
public String name = "circle";
public Circle() {
System.out.println("circle constructor");
}
public void printType() {
System.out.println("this is circle");
}
public static void printName() {
System.out.println("circle");
}
}
shape constructor
circle constructor
shape
this is circle
shape
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有