• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Class (Day)

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I tried to wirte down my Day class, but I'm all confuse !!!

this is what I wrote , I'm getting all kinds of error when I'm compiling(beside the fact that the class is not complete !!)

If anybody can help me on this one, I'd really appreciate.
(once again, sorry if the code is in french, my java course is in french !!)




public class Journee {

// variable(s) de classe s'il y a lieu
private String lundi = "lu";
private String mardi = "ma";
private String mercredi = "me";
private String jeudi = "ju";
private String vendredi = "ve";
private String samedi = "sa";
private String dimanche = "di";

// variable(s) d'instance s'il y a lieu
String jourSemaine;

// constructeur(s) s'il y a lieu
public journee(String joursemaine){
lundi = new string(joursemaine);
mardi = new String (joursemaine);
mercredi = new String (joursemaine);
jeudi = new String (joursemaine);
vendredi = new String (joursemaine);
samedi = new String (joursemaine);
dimanche = new String (joursemaine);

}


// m�thode(s) de classe s'il y a lieu

// m�thode(s) d'instance s'il y a lieu
public String getSequence(){
return new String("lu");
}
public void setSequenece(Stringjoursemaine){
"lu"= new String(joursemaine);
}
public String getSequence(){
return new String("ma");
}
public void setSequenece(Stringjoursemaine){
"ma"= new String(joursemaine);
}
public String getSequence(){
return new String("me");
}
public void setSequenece(Stringjoursemaine){
"me"= new String(joursemaine);
}
public String getSequence(){
return new String("ju");
}
public void setSequenece(Stringjoursemaine){
"ju"= new String(joursemaine);
}
public String getSequence(){
return new String("ve");
}
public void setSequenece(Stringjoursemaine){
"ve"= new String(joursemaine);
}
public String getSequence(){
return new String("sa");
}
public void setSequenece(Stringjoursemaine){
"sa"= new String(joursemaine);
}
public String getSequence(){
return new String("di");
}
public void setSequenece(Stringjoursemaine){
"di"= new String(joursemaine);
}

public boolean equals(Sequence j1){
boolean result
if(this.lundi ==j1.lundi){
result = this.

} // Journee
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many errors, but here are some of the obvious ones...



1. Java supports overloading if the signatures are different. All your getSequence() and setSequence() methods have the same signatures.

2. I assume you don't mean "Stringjoursemaine", probably forgot the space.

3. You can't assign to a string literal. "di" is a value, not a variable.

Henry
 
reply
    Bookmark Topic Watch Topic
  • New Topic