According to the usage you mention, a stack would be more useful than a queue.
Also take a look at this thread.
According to the usage you mention, a stack would be more useful than a queue.
Also take a look at this thread.
@staneja : Atleast care to see the post date, before posting question to him. It's better to start a new thread than to revive a four year old thread.
Rate, Gate, Tea
Bottle
Federer is a better player than Rafa.
It is against the rules to be repeated.
Will obeying a lot of rules make you a bore ?
Hate it.
Web Surfing ?
My judgement here is that there was no infinite loop at all. When you are running a GUI based program you don't get to see any exceptions thrown by the JVM. Now, when your index counter was reaching 'size' then the JVM would have been throwing an exception which since your program being a GUI program you wouldn't have had an oppurtunity to see. This happens becuase the exception is thrown to the standard output stream which is typically the console. Since the program halted at that instruction the instruction
CompSciAPPane.showMessageDialog(All, APLabel, "Computer Science AP", JOptionPane.PLAIN_MESSAGE);
never got executed and hence you never got to see the JOption Pane which led you to believe that since there was no output, there must have been an infinite loop somewhere.
@stephen84s : Yes but in this case, what happens if he inputs the number of adult tickets to be 110 ? You still ask him for the number of child tickets, which since he has already jumped the maximum count is wrong on our part. If he enters the no. of adult tickets to be greater than 100 he should be warned of the limitation there itself rather than proceeding.
Take a look at this post for a solution.
You could flash this information at the start that the total number of tickets would be restricted to 100. Now, when suppose, he enters the number of adult tickets to be 70, you again flash him that the total count is capped off at 100 of which 70 he has already booked, so that he can at the most book only 30 child tickets.
The adult ticket number is to be checked to be in between 0 and 100 whereas the child ticket number is to be between 0 and 100 - no. of adult tickets.
Ring; Rag; Rog
Skeptic
Beautiful because the word itself is so reminiscent of it's meaning.
Well why do you have laugh after every post of yours, we don't find it anywhere near to being funny.
Day breaks just after the night has been it's darkest !!!
You can use a do while loop to restrict no. of tickets entered from being negative or greater than 100.
Ex:
do{
System.out.println("How many tickets ?");
atickets = keyboard.nextInt();
// check for input being in the range (not < 0 and not > 100)
// if input is in range set flag to true
}while(flag==false);
I am here to cause I like to have some fun along the way.
Do you like reading ?
Ohh common now, I am tired of doing that. Everytime you get up to change your position you land on the surface 5 minutes later.
Keeping pet animals ?
This is a problem of your JDK (JAVA_HOME) path not being set. Thats the reason the program doesn't get a java compiler. And if you read the ToolProvider docs, it says that the method getSystemJavaCompiler
returns null if no compiler is provided.
In your Linux system, set the PATH variable to %JAVA_HOME% then export the path, by writing EXPORT PATH on the next line. For this to take effect you need to logout of your X-window system, so just do a ctrl-alt-backspace and login again, and then try to run the program.
Ohh..You sure you haven't tried Daniwebbing ? Okay then, I'll answer your question the same way.
I live on an island. Going to a Beach ? Naah HTI.
Star Gazing ?
hep.. hep!!!
What are you trying to convey from this, other than that you are a .....
538
If you like it that way.
What are the reason you are here ?
How are you creating the file ? If it is done with an absolute path then we need to see the code to tell you what might be going wrong. If it is created with a relative path in your program then the file certainly won't be created in the same place that it was created when the program was run from NB. It would be created in the directory from where you are running teh program now, i.e. your script.
Edit : Don't be shy to post your code, you have already been asked for it. It's only you who would be benefited since your query might get sorted out faster. Also if you are afraid we would steal your code, don't worry we won't. We just steal it when we have appraisals coming up and that too of the colleagues who trust us the most ;)
:* I hate this thread.. :*
ahihihii...:twisted:
Why do you have to put your username after every post of yours ? Just a question that comes to mind seeing your posts.
You don't have to, you just used one of them.
Will this be repeated again ?
ok.. i will continue..
What fast food do you like?
You did not answer my question.
HTI
Daniwebbing ?
@masijade : You could easily have been a detective, you have the temparament and the ability to look into the slimmest of the crevices. ;)
he can learn a lot of gaming softwares and programmes but.., i think he should learn some of the basic subjects as well.. like.. math.. history... nahh.. not important.. learn java ., c++ instead.. hehe :P
I fail to understand the point of this post. The OP isn't returning back here. This fact was underlined way earlier which was second sited by me to obj7777 in my previous post, yet you are adding to it. Also you aren't even mentioning anything that hasn't already been mentioned earlier.
@jpp10 :
The StringTokenizer is legacy class and it's use is not recommended, the java people themselves say this. You can find it in the documentation provided for that class.
Use the split()
method of the String class as suggested.
Which methods ? Have you even cared to go through the iText library and the Apache POI ? They both are stable production quality libraries.
Do your homework before posting blindly.
But isn't it better to treat the HTML tags such as HEAD, BODY, TABLE as one and not consider them on a character by character basis. Read my post above.
You have already been offered help, only if you care enough to take it.
@ajithraj :
> Object can be distroyed using:::: object = null
No, as masijade explains, and as I was assuming you to have the destruction of an object in your mind. Thats the reason I asked you the question 'How are you going to destroy it'.
If "destroying" an object refers to freeing up the memory space associated with that object, as it should be, you can never destroy an object in Java. What you do by assigning a null value to a reference, is that you take a reference away from the object, is effect just decrementing it's reference count. The Garbage Collector will collect all objects that have a reference count as zero. So your assigning a 'null' value to the reference just announces on your part that that reference no longer needs that object, but there may however be other references that continue to refer to that object and hence the object may never get GCed.
To tell you about why calling System.gc() is not a recommended practice, masijade has already given you most of the answer, mentioning that calling System.gc(), is only a "suggestion" to the JVM that now would be a good time to do GC. But whether the JVM obeys you, acting like a good genie, or not is a completely different matter altogether. Also it has good reason to not to obey you if it does that, because JVMs today have highly efficient and effective …
make up your mind.
How are you going to arrange a list in 2D ? You would have to make a list of lists. With the first list just holding the heads of the list starting at that position. Something like this :
|L1 -> List L1 follows...
|L2 -> List L2 follows...
|L3 -> List L3 follows...
|L4 -> List L4 follows...
Now each of this list will have individual nodes carrying data (plant/flames) So for planting a plant at (3,4) you need to insert the data "P" at the 4th node of the 3rd list (L3). Same for the flames. So you would need two data elements in each node.
Alternatively you can also use a 2D array of Strings, manipulating which, according to me, would be far more easier. Whenever you have a plant to be planted at location (3,4) you write the string "P" at the index [3][4] of the array. IF you need a flame too on the same location you have a string "PF" for only a flame you can use "F".
Traversing the lists, in the first approach and the array in the second approach would give you the current snapshot of the field.
The only thing where the second approach is restrictive is the disadvantage that arrays present to you, you need to know the maximum number of locations (rows & columns) in advance, if you are going to be knowing this in advance, I suggest you use …
For everything that they can be used.
Typically for taking user input from console.
PS : Ignore this, masijade has given you the world !!!!
no idea how the class file got there, i certainly didnt put it there. all i did was change the directory to Ass_5.
OSes are not habitual of moving files while the CPU is idle. ;)
for the program to find the .txt files they should be in the src directory shouldnt they?
No, they should be in the directory from where your classes are run. Typically in the classes directory.
Check from where your JCreator is running your classes.
This gives me the feeling that this code is not written by you, can you tell us why so ?
How does the src directory contain a .class file ? That tells us that everything is not in the right place.
On other thoughts, detail your problem if you want my solved threads count to go up, becuase I have a feeling I can solve this problem. It has all the characteristics of one, it is not concerning to Java, it only has limited players (a few files and directories) and on top of it , it looks trivial.
PS : Damn I should nail this one before anyone else does.