Homework 3

This commit is contained in:
Carlos Galindo 2020-01-15 22:32:25 +01:00
parent bf60a078d7
commit 0afc86ceeb
Signed by: kauron
GPG key ID: 83E68706DEE119A3
129 changed files with 3163 additions and 4316 deletions

View file

@ -0,0 +1,7 @@
// Error: the return type of the "main" method must be "void"
class Main {
int main() {
return 10;
}
}

View file

@ -0,0 +1,5 @@
// Error: the main method must have no arguments
class Main {
void main(Object[] args) {}
}

View file

@ -0,0 +1,4 @@
// Error: there is no class called Main (case-sensitive)
class MAIN {}
class main extends Object {}

View file

@ -0,0 +1,11 @@
// Error: the "Main" class does not contain a method called "main"
class Main {
void maini() {}
void mein() {}
void moon() {}
}
class NotMain extends Main {
void main() {}
}

View file

@ -0,0 +1,7 @@
// The main method can be inherited from another class
class OtherMain {
void main () {}
}
class Main extends OtherMain {}

View file

@ -0,0 +1,15 @@
// The main method can be overridden in the inherit process, as any other method can
class A {
void main() {
write(1);
}
}
class B extends A {
void main() {
write(2);
}
}
class Main extends B {}