Skip to content
Snippets Groups Projects
Commit 68453c6a authored by Hugo Debuyser's avatar Hugo Debuyser
Browse files

ajout fichiers tp1

parents
No related branches found
No related tags found
No related merge requests found
Showing with 151 additions and 0 deletions
File added
File added
File added
File added
File added
File added
import controlepkg1.A;
import controlepkg2.B;
import controlepkg2.sspkg.C;
import controlpkg1.D;
public class Main{
public static void main(String[] args) {
A a = new A("Toto");
B b = new B();
C c = new C("Tata", 5);
D d = new D();
System.out.println(a.toString());
System.out.println(c.toString());
System.out.println(b.toString());
System.out.println(d.getSomeText());
}
}
\ No newline at end of file
package controlepkg1;
public class A {
private String aLabel;
public A(String aLabel) {
this.aLabel = aLabel;
}
@Override
public String toString() {
return "A [aLabel=" + aLabel + "]";
}
}
package controlepkg2;
public class B {
private int aNumber = 42;
@Override
public String toString() {
return "B [aNumber=" + aNumber + "]";
}
}
package controlepkg2.sspkg;
public class C {
private String aLabel;
private int aNumber;
public C(String aLabel, int aNumber) {
this.aLabel = aLabel;
this.aNumber = aNumber;
}
public String getALabel() {return aLabel;}
public void setALabel(String aLabel) {this.aLabel = aLabel;}
public int getANumber() {return aNumber;}
public void setANumber(int aNumber) {this.aNumber = aNumber;}
@Override
public String toString() {
return "C [aLabel=" + aLabel + ", aNumber=" + aNumber + "]";
}
}
package fifth;
import fourth.A;
public class B {
public static void main(String[] args) {
System.out.println("class B -- main()");
A a = new A();
System.out.println(a + " again");
}
}
public class A{
private final String LABEL = "42";
private String label;
//construtor
public A(){
this.label = this.LABEL;
}
public A(String label){
this.label = label;
}
//methods
public String toString(){
return this.label;
}
public static void main(String[] args) {
A a1 = new A();
A a2 = new A("à choisir");
System.out.println(a1.toString());
System.out.println(a2.toString());
}
}
\ No newline at end of file
package fourth;
public class A{
private final String LABEL = "42";
private String label;
//construtor
public A(){
this.label = this.LABEL;
}
public A(String label){
this.label = label;
}
//methods
public String toString(){
return this.label;
}
}
\ No newline at end of file
public class A{
private final String LABEL = "42";
private String label;
//construtor
public A(){
this.label = this.LABEL;
}
public A(String label){
this.label = label;
}
//methods
public String toString(){
return this.label;
}
}
\ No newline at end of file
public class B {
public static void main(String[] args) {
System.out.println("class B -- main()");
A a = new A();
System.out.println(a + " again");
}
}
package compil_src.third;
public class A {
public static void main(String[] args) {
System.out.println("Pkg third - Class A - main program");
}
}
git_test @ 5b324d70
Subproject commit 5b324d708180e3d906240227468075f611fb613c
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment