Home > Back-end >  JAVA code optimization
JAVA code optimization

Time:10-09

The import javax.mail. SQL. Rowset. Spi. SyncResolver;

Interface't interface//regards
{
Void say ();
}
Interface work//work interface
{
Void say1 ();
}
The class Student implements't
{
Public void say ()
{
System. The out. Println (" Peter: good teacher ");
}
}
The class the Teacher implements't
{
Public void say ()
{
System. The out. Println (" mike: good students ");
}
}

The class Student1 implements work
{
Public void say1 ()
{
System. The out. Println (" mike: teacher start ");
}
}
The class Teacher1 implements work
{
Public void say1 ()
{
System. The out. Println (" Peter: the teacher began to take notes ");
}
}
The class Main
{
Public static void main (String [] args)
{
't [] saith={new Student (), new to the Teacher ()};
The work [] says1={new Student1 (), new Teacher1 ()};
For (int I=0; i{
Says [I] say ();
}
For (int I=0; i{
Says1 [I] say1 ();
}
}
}
This code can also optimize??????
  • Related