enrique garcia

Greenhorn
+ Follow
since Dec 03, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by enrique garcia

When I resolve one problem 10 new errors appear. Always

Edit: Now the compiler says 3 times

Illegal modifier for the local class NaechsteKarteListener; only abstract or final is permitted




And, what is very confusing: new mistakes appeared, which where no mistakes before:

The field kartenListe is defined in an inherited type and an enclosing
scope




The only thing I changed was to insert a class with a text file before the BufferedReader is declared (at least it looks that I did that ok)
8 years ago
hum.. When a class is never used locally (The type Textdatei is never used locally), what can I do? I tried to implement the class, but this doesn't work?
8 years ago
I put
into the quizcard file. The compiler says "Unreachable code". So I have to put this string somewhere else. But where and how?
8 years ago
Ok, what I need is some kind of text-string for that what is written on the cards. I already had a try with something like this:



Christophe Verré wrote:You'll find all samples here.



unfortunately this site doesn't give any hint regarding how to set up the text string for the quiz cards.



Edit: This is how my code looks like now
8 years ago
"eins" is the german word for "one", "zeile" means "line"

basically, what I want to do is put a string into a text file, store this file in a file object and then making it possible to read from this text file. This casting thing is really confusing. I think I will not change any code from now on until I get it clear which class is where and does what. Also your second point looks interessting, I will bear that in mind
8 years ago
ok, I guess there are a lot of mistakes. I am reading the HeadFirst book from O'Reilly. This is also the very first time I am doing any programming. I am trying to fix this class for 3 days now. Can anyone please give me a link to the entire (working) code of quizcard from chapter 14, HeadFirst, O'Reilly?
8 years ago
omg I think I got it !

Now, the only thing I have done wrong is here

the compiler says

meineQuizkarte cannot be resolved to a type, objectOutputStream cannot be resolved, fileWriter cannot be resolved



How comes the ObjectOutputStream doesn't get the stuff?
8 years ago
I guess this means I have to cast QuizKarte somehow, right?

Eclipse is likely complaining about line 8. You are using a variable name QuizKarte, and you don't seem to have a declaration for it. And classes and variables are two different things -- just because you have a class name QuizKarte doesn't mean that there is an implicite instance of it somewhere.



Now, the string in QuizKarte should be available - which I am quiet sure wasn't before:




So, when I set a cast for QuizKarte it works? Could it be something like this?

8 years ago
ok, so I changed the name into QuizKarte



unfortunately the Eclipse seems to complain now with this message:

QuizKarte cannot be resolved to a variable



but there is a class called QuizKarte with strings in it, at the beginning of the code?!
8 years ago
hi guys, I have a Problem with this class. Eclipse says:

Multiple markers at this line
- Return type for the method is
missing
- file cannot be resolved to a
type





the rest seems to be ok, as Eclipse shows no mistakes:


// Snip large piece of code


Can you give me please give me a hint so that I can run the program???
8 years ago
I am referring to the final version. On the quizcard there has to be text. One question, followed by an answer after clicking the button. Now, what I would like to know is where to put the question.

Question(Frage): Which color do you like?
Answer(Antwort): Green.

this is my entire code

8 years ago
Hi, where exactly does one put the questions and answers for the cards?
8 years ago
omg! the problem was the semicolon after for (int i = 5; i < 60; i+= 4); {

so now it is correct:

8 years ago
the compiler says

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
i cannot be resolved to a variable
i cannot be resolved to a variable
i cannot be resolved to a variable
i cannot be resolved to a variable
i cannot be resolved to a variable

at minimusikplayer2.MiniMusikPlayer2.los(MiniMusikPlayer2.java:25)
at minimusikplayer2.MiniMusikPlayer2.main(MiniMusikPlayer2.java:9)




I will be thankfull for any support. Now I have to go but I will be back in 5 hours!!!

The problems are in line 25,26 and 27

package minimusikplayer2;

import javax.sound.midi.*;
public class MiniMusikPlayer2 implements ControllerEventListener {


public static void main(String[] args) {
MiniMusikPlayer2 mini = new MiniMusikPlayer2();
mini.los();
}

public void los() {
try {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();

int[] gewuenschteEvents = {127
};
sequencer.addControllerEventListener(this, gewuenschteEvents);

Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();

for (int i = 5; i < 60; i+= 4); {

track.add(eventErzeugen(144,1,i,100,i));

track.add(eventErzeugen(176,1,127,0,i));

track.add(eventErzeugen(128,1,i,100,i + 2));

}
sequencer.setSequence(seq);
sequencer.setTempoInBPM(220);
sequencer.start();
Thread.sleep(5000);
sequencer.close();
}catch (Exception ex) {ex.printStackTrace();}
}
public void controlChange(ShortMessage event) {
System.out.println("la");
}

public MidiEvent eventErzeugen(int comd, int chan, int one, int two, int tick){
MidiEvent event = null;
try{
ShortMessage a = new ShortMessage();
a.setMessage(comd,chan,one,two);
event = new MidiEvent(a, tick);

}catch (Exception e){}
return event;

}
}

8 years ago