7,116 Posted Topics

Member Avatar for Skotie44

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 …

Member Avatar for JamesCherrill
0
321
Member Avatar for patel.jeel92

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 …

Member Avatar for JamesCherrill
0
159
Member Avatar for blindislands

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/

Member Avatar for JamesCherrill
0
176
Member Avatar for Violet_82

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.

Member Avatar for Violet_82
0
3K
Member Avatar for reincom

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 …

Member Avatar for JamesCherrill
0
188
Member Avatar for stackOverflow

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. _______________________________________________________

Member Avatar for stultuske
0
9K
Member Avatar for mikewyatt

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 …

Member Avatar for mikewyatt
0
887
Member Avatar for RWD_

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

Member Avatar for JamesCherrill
0
718
Member Avatar for blue_Student

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?

Member Avatar for JamesCherrill
0
240
Member Avatar for software girl

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.

Member Avatar for JamesCherrill
0
741
Member Avatar for reincom
Member Avatar for bob.henry.1884

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.

Member Avatar for JamesCherrill
0
81
Member Avatar for minimee120

What was the idea behind your textValueChanged? When the text is changed your code then duplicates the last letter - that seems wrong.

Member Avatar for JamesCherrill
0
272
Member Avatar for Ms

> 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 …

Member Avatar for JamesCherrill
0
3K
Member Avatar for david_25

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 …

Member Avatar for JamesCherrill
0
134
Member Avatar for COKEDUDE

... another reason to use split() is that it returns an array of exactly the right length, ie every value in the array is filled.

Member Avatar for stultuske
0
191
Member Avatar for Hanyouslayer

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 …

Member Avatar for Hanyouslayer
0
816
Member Avatar for DamianPrinze

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* …

Member Avatar for minimee120
0
2K
Member Avatar for drsnet41

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 …

Member Avatar for sepp2k
0
12K
Member Avatar for somjit{}

[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)

Member Avatar for JamesCherrill
0
146
Member Avatar for ZombieKnight93

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

Member Avatar for ZombieKnight93
0
7K
Member Avatar for jess_35

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

Member Avatar for JamesCherrill
0
283
Member Avatar for sasikrishnasamy

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 …

Member Avatar for JamesCherrill
0
306
Member Avatar for Hanyouslayer

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 …

Member Avatar for JamesCherrill
0
345
Member Avatar for Pyler

Good. Now please mark ALL your threads for reverse list problems as "solved"

Member Avatar for JamesCherrill
0
223
Member Avatar for woomar

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])

Member Avatar for JamesCherrill
0
753
Member Avatar for android_gl
Member Avatar for JamesCherrill
0
307
Member Avatar for tindoh

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.

Member Avatar for somjit{}
-1
171
Member Avatar for somjit{}

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.

Member Avatar for JamesCherrill
0
179
Member Avatar for reincom

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.

Member Avatar for JamesCherrill
0
200
Member Avatar for cleve23

Instance methods are called based on the actual class of the object used to call them. The type of the reference variable is irrelevant.

Member Avatar for JamesCherrill
0
209
Member Avatar for Pyler
Member Avatar for Pyler

> 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 …

Member Avatar for stultuske
0
176
Member Avatar for reincom

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

Member Avatar for reincom
0
146
Member Avatar for piyush_2

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 …

Member Avatar for JamesCherrill
0
208
Member Avatar for android_gl

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.

Member Avatar for JamesCherrill
0
125
Member Avatar for dnanassy

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

Member Avatar for somjit{}
0
785
Member Avatar for Manny01

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!

Member Avatar for JamesCherrill
0
116
Member Avatar for nitin1

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 …

Member Avatar for JamesCherrill
0
248
Member Avatar for jtresue

> Is it somewhat like a notification for the user? That's exactly what it is.

Member Avatar for JamesCherrill
0
3K
Member Avatar for Pyler

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 …

Member Avatar for Pyler
0
1K
Member Avatar for newbie14

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 …

Member Avatar for newbie14
0
291
Member Avatar for Conquero

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

Member Avatar for stevelg
0
125
Member Avatar for bibibengo

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 …

Member Avatar for JamesCherrill
0
272
Member Avatar for Seswing142

... 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 …

Member Avatar for JamesCherrill
1
3K
Member Avatar for Lloyd_2

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

Member Avatar for stultuske
0
861
Member Avatar for Thermalnuke

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 …

Member Avatar for JamesCherrill
0
478
Member Avatar for cakka

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)

Member Avatar for stultuske
0
341
Member Avatar for kal_crazy

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?

Member Avatar for kal_crazy
0
1K
Member Avatar for kal_crazy

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 …

Member Avatar for JamesCherrill
0
2K

The End.