7,116 Posted Topics
Re: I_1 What exactly is the point of your post? This thread was dead 7 years ago. And anyway, we don't do people's homework here, so just posting an uncommented, unexplained, repetitive, fragile code down't really help anyone. As a newcomer you may find it useful to spend a little time … | |
Re: Your logic is a problem. You create new empty list then interate through its contents (since there are none, this does nothing) then you return the list. It's empty, so of course the first & last pointers are null. It needs to be more like (pseudocode) create new empty list … | |
Re: Processing is loosly based on Java, but the details of drawing things are very different, so I doubt that you will find your answer ina Java forum. Sorry. Why not try Processing's own forum? http://forum.processing.org/two/ | |
Re: They're simple literals. Just like the "h", "o", "u" etc at the start of the string. Anythingthat's not part of a "format specifier" is"fixed text" (ie a literal). See the API doc for the Formatter class for complete detailed descriptions of all the format string options. | |
Re: There's no reason to use an integer field to store phone numbers. You won'r be doing arithmetic with them. Most people prefer to enter and see them with some formatting, eg a - or blanks between groups of digits. There is also the convention for international prefixes that looks like … | |
Re: Debi DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question This thread is CLOSED. _______________________________________________________ | |
Re: The java classes and other resources just go into a jar file. For the databases maybe you could use System.getProperty to get the user's home directory and place the databases in a new directory inside the user directory - that should work on any OS. (You can also get a … | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question | |
Re: You have a good scattering of print statements there, so can you tell us which code is actually being called when? Eg does the document listener interface correctly call getIn() each time you type in the text field? | |
Re: Read the API doc for Arrays class, sort() method. We don't write people's homework for them, but make an effort and someone will help. | |
| |
Re: That question makes no sense. How would you add up the values of multiple URLs, or Booleans, or Employees? You need to provide more info on your "objects". Asking for code (especially such a totally trivial piece of code) for homework isn't popular behaviour here. Do some work yourself first. | |
Re: What was the idea behind your textValueChanged? When the text is changed your code then duplicates the last letter - that seems wrong. | |
Re: > Key listeners have their place as a low-level interface to keyboard input, but for responding to individual keys key bindings are more appropriate and tend to result in more easily maintained code. Key listeners are also difficult if the key binding is to be active when the component doesn't … | |
Re: 1. By each having a reference to the other. Eg your Car class is connected to your Person class via the driver variable. Inheritance is also called an "is a" relationship (Cat *is a* Mammal). You can also have a "has a" relationship (Car *has a* Driver) 2. When the … | |
Re: ... another reason to use split() is that it returns an array of exactly the right length, ie every value in the array is filled. | |
Re: Scanner was intended as an easy tool for beginners, but in reality it's a poor implementation, and causes more problems than it solves. Forget it. I would just read each line of the file, then split it onto an array of words using String's *split()* method. You can then use … | |
Re: DamianPrinze DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules If you have a specific question then ask it and explain what you have done so far. People *will* … | |
Re: That looks like you're piping the file to the std input stream. I don't know if that's possible when executing within Eclipse. Far better to create your Scanner using the file directly, not via System.in. You can pass the file name into your java program as a parameter when you … | |
Re: [Dining Philosophers](http://en.wikipedia.org/wiki/Dining_philosophers_problem) is a lot of fun, and trickier than it looks. It's a classic where the solution is hard to wrap your brain around, but really not so hard once you've got it. Strongly recommended for building your threading [qi](http://en.wikipedia.org/wiki/Qi) | |
Re: One thing that jumps out is that you seem to be using values 1-10 as indexes for your array, but Java arrays are zero-based - the valid indexes are 0-9 | |
Re: Line 44 it's unlikely that getText will return null. For an empty field it will return an empty String, ie "". You can test for equals(""), or use length()==0 | |
Re: Onl line 4 you create an ArrayList, and a reference variable that refers to it. On line 11 you call addB passing the reference (the variable called list) to your ArrayList. In that method you get a copy of that reference and you call that list1. Now list and list1 … | |
Re: mKorbel, as usual, is right. You may think that code is OK, but it's going to fail. Calling getGraphics and just drawing there hasn't worked since Java 1.5 made double-buffering the default. It may work (especially the very first time), but will fail totally later, eg when the window is … | |
Re: Good. Now please mark ALL your threads for reverse list problems as "solved" | |
Re: For a deep copy you need to copy *everything*, all the way down, so instead of board[i][j] = other.board[i][j]; it should be board[i][j] = a copy of (other.board[i][j]); (how that works depends on how you can copy whatever is on other.board[i][j]) | |
Re: android.gf, somjit: That's enough now. Keep this strictly to the Java question. | |
Re: Java language is somewhere between c++ (hard) and Basic (easier), but that's not what matters. It's the API or libraries that you need. IMHO the Java API is easier than .net, and both are vastly easier than having to write all that stuff yourself. | |
Re: Method *of* an object seems to imply a method defined for that object type Method *for* an object seems to imply the object is the invocation target when the method is called. | |
Re: I like the style of using factory methods that build and return a menu bar or other complex components. Nothing wrong with it at all IMHO. It certainly makes the code easier to read and understand. | |
Re: Instance methods are called based on the actual class of the object used to call them. The type of the reference variable is irrelevant. | |
Re: > newLS.rev() returns Pain instead of a reversed stack On the basis of what you have posted... no, it doesn't! The definition of the rev method above shows a return type of LinkedStack<T>, so there is zero possibility that it returns a value of "Pain". There is obviously something else … | |
Re: You should take 5 minutes to read this Oracle tutorial (on internal frames and how to use them) before doing anything else... http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html | |
Re: You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java … | |
Re: You really should be asking these questions of the person who wrote the tutorial. But more seriously: Do you have the copyright owner's approval to post that code here? if you cannot confirm that a.s.a.p. I'm afraid I will have to delete it. | |
Re: That's a lot of code to examine for problems that you have not specified properly - "got messy" doesn't help much, ditto "throws exceptions". If you post an exact description of the problem(s), with complete copies of all error messages then that will help people know what to look for | |
Re: The Oracle java tutorials will teach you everything you need to know about GUIs. Start [here](http://docs.oracle.com/javase/tutorial/uiswing/index.html) To build a web crawler and web extractor from scratch you will need some [basic networking Java classes](http://docs.oracle.com/javase/tutorial/networking/overview/index.html) Good luck! | |
Re: What's in run-cbf.bat? I don't recognise that as a standard Java JRE-installed file... What people normally do is to export their project as a runnable jar (details for that vary from one IDE to another) then run that with java.exe (not javaw.exe which supresses the console output). java.exe sends your … | |
Re: > Is it somewhat like a notification for the user? That's exactly what it is. | |
Re: Sounds like you may be printing your stack elements (ie your class with a data item and the pointer to the next elements)? If so you need to provide a toString method for that class, in which you could return something like `"List element: " + theDataItem`. The string concatemation … | |
Re: JVM memory usage is a lot more complex than this kind of analysis suggests. If you have a memory problem, you can use visualvm to perform all kinds of profiling in a way that may be more helpful to you. http://visualvm.java.net/ ps a version is included as standard with current … | |
Re: I'm sure someone will help you fixr for loops - but since we're not mind readers you'll have to post your current code | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question Also "Do provide evidence of having done some work yourself if … | |
Re: ... and even better, try using the Java conventions for naming variables, especially booleans. What do you think someone will understand from `flag = false;`? What does that mean? How does that relate to` anotherFlag = false;`? Boolean names ideally describe the thing that will be true if the variable … | |
Re: Instead of *System.out*.println use *yourPrintWriter*.println (etc) replace `System.out.println(e.toString());` with `e.printStackTrace();` to see the calling sequence and line number when the exception was thrown | |
Re: I assume HighArray is some kind of ArrayList-like object, so all you need is around line 18 to delete the duplicate you just found. Remember that you will need to update k to allow for that deletion otherwize you won't detect consecutive duplicates. ps line 12 etc is redundant because … | |
Re: 5 and 05 are ints, not objects, so yo ucan't use compareTo directly for those values, but: 5 == 05 is true (same numeric value) "5" == "05" is false (different tsrings) | |
Re: Do you understand what that code does? Have you been able to use it to draw some ovals or anything else? Do you have any data that defines the position/location of each Node? | |
Re: Yes. Show some initiative and get on and do some work. Do some research to fill in any gaps in your knowledge (use the internet). Write and test both implementations. Compare their speeds... If your tutor gave you this assignment then obviously (s)he expects it to stretch you, but (s)he … |
The End.