шпаргалки
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
937 B

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dev_j2022_2;
/**
*
* @author denis
*/
public class Dev_j2022_2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Device[] devices = new Device[5];
String line = " Hello";
devices[0]=new ElectronicDevice();
devices[1]=new MechanicalDevice();
devices[2]=new ElectronicDevice();
devices[3]=new MechanicalDevice();
devices[4]=new Device();
for(int i=0 ; i<devices.length ; i++){
devices[i].print();
}
ElectronicDevice e1 = new ElectronicDevice();
Device e2 = new ElectronicDevice();
((ElectronicDevice)e2).setPower(15);
}
}