3,927 Posted Topics
Re: I think the null pointer exception is occurring from the printStream.println() call, rather than the exec() call. You haven't initialized "printStream", so when the error from that exec() command is thrown (which is that "cls" is not a program, by the way), the catch statement is throwing the exception out … | |
Re: You aren't very clear in what it is that you are wanting to do. What is the point of using a linked list in one class to access an array of objects in another? You'll need to post a bit more information. | |
Re: If you don't even have any idea how to start, you don't really have a project. You have a name of a project. If you don't have any idea what you want to accomplish, how do you expect anyone to help you accomplish it? It sounds like you need to … | |
Re: You actually do not need classes for the input at all, as they are just making a single call to show your input dialog. A class isn't needed to wrap a single function call. You can put a small helper method in your Calculate class which handles the input part … | |
Re: Not in his case, if the change is 0.38, he would want dimes to equal 3, not 4. | |
Re: No, it is not possible. Main() is the only method that can be run with the "java myClass" call from the OS. | |
Re: See the following example on comparing dates: [url]http://exampledepot.com/egs/java.util/CompDates.html?l=rel[/url] and you can find a lot of information on using the date-related API classes here: [url]http://mindprod.com/jgloss/calendar.html[/url] | |
Re: I would hope that your class would have. You do have some notes I assume? | |
Re: Here are a couple of tutorials: [url]http://blogoscoped.com/archive/2004_06_23_index.html[/url] [url]http://www.devnewz.com/devnewz-3-20041221UsingPHPCURLLibrarytoScrapetheInternet.html[/url] It's just a matter of obtaing the HTML from a request and parsing out the data you need. | |
Re: [QUOTE=chandra.rajat;522628]sounds good .... or how bout 'a junior poster in training' actually gets access to some training material from the site.. or he's assigned an expert as a buddy who he can go to once in a while for help :)[/QUOTE] The site [U]is[/U] the training material. And since the … | |
Re: Looks mostly fine to me. Do you have any package statements in that class file? | |
Re: Well, that is about the longest way around the problem if you simply want to know the java version from within a program. All you need is[code=java]System.getProperty("java.version");[/code] There is a lot of other info available as well[code=java] for (java.util.Map.Entry s : System.getProperties().entrySet()) System.out.println(s.getKey()+": "+s.getValue());[/code] But all that is completely irrelevant … | |
Re: [QUOTE=jessxe02;523194]plss give me some basic example of sorting with user input!!!! thx[/QUOTE] Sorry, we are here to help with code that people are having trouble with - not provide example code on demand. Post your efforts and specific questions about the trouble you are having. If you haven't made any … | |
Re: You can accomplish it quite easily with either regex (see [URL="http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html"]Pattern[/URL] and [URL="http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html"]Matcher[/URL]) or with a simple String.split(",") to separate the pair. For the date part you can use [URL="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html"]SimpleDateFormat[/URL] if you need to parse to a date value from the string. | |
Re: [CODE] public class Card { [B]getSuit(); // These are invalid calls - you cannot do this here getRank();[/B] [B]// you have not declared rank and suit member variables // you can have a static array for the rank values here and initialize it with // a static block.[/B] publlic Card(int … | |
Re: Why do you need to run the OS command instead of using File.delete()? | |
Re: Well, you are showing two different file names there, so that might be a problem. If you are having difficulties with specifying a relative file path, make sure that path resolves correctly against the current user directory, which can by checked with System.getProperty("user.dir"). | |
Re: I don't know, but I would imagine the homework assignment entails whether [U]you[/U] can prove it. | |
Re: Plenty of practice tests available on the net. Just search for them. | |
Re: Also, your calculation isn't keeping track of the remainder after the higher coins have been returned. If you have 0.70 in change, your current calcs would show 2 quarters, 7 dimes, 14 nickels, etc. I think you want to display 2 quarters, 2 dimes as the result. | |
Re: And what exactly is your question? You don't expect anyone to just answer the homework problem for you, do you? | |
Re: Please don't start multiple threads for the exact same question. | |
Re: [QUOTE=shaikh_mshariq;512897]Please read Details carefully before your suggestion.[/QUOTE] Your post does sound like you want to create it in c++. Don't berate others for your own failure to write something clearly. | |
Re: Search these forums for "final project" and you will have plenty to read. | |
Re: [QUOTE=jaepi;506392]Kill Michael Jordan and see what will happen to the Chicago Bulls without him.[/QUOTE] I think you need some therapy. | |
Re: This is a class path problem. The class path let's Java know where to locate classes for your file. Post the command that you are using to run the program and a bit of directory information on where that class file resides. | |
Re: You may also want to consider using the Scanner class with regular expressions. And once again I'll request: [U]Please use [ code ] tags to format code in your posts so indentation is preserved.[/U] | |
Re: You cannot declare a method within a method like that, which is what this line is trying to do[code]public void actionPerformed_Plus()[/code] ![]() | |
Re: If you are using Java 1.6, the Console class provides a mechanism for this: [url]http://java.sun.com/docs/books/tutorial/essential/io/cl.html[/url] | |
Re: Sorry, this is not a code warehouse for you. Also, see the forum rules regarding "text speak" : [url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies#faq_keep_it_clean[/url] | |
Re: Well, if the Runnable has a method which Class A can call when appropriate, it can simply sleep while monitoring for whatever state Class A is expected to set. For some general info, this article on thread messaging may be useful: [url]http://www.informit.com/articles/article.aspx?p=167821&rll=1[/url] | |
Re: Opening SSL socket: [url]http://www.exampledepot.com/egs/javax.net.ssl/Client.html?l=rel[/url] XML (see Chapter 2): [url]http://java.sun.com/j2ee/1.4/docs/tutorial/doc/[/url] Writing to file: [url]http://www.exampledepot.com/egs/java.io/WriteToFile.html[/url] | |
Re: And what is the question? Posting your assignment is not sufficient. | |
Re: Because your method signature takes a single parameter "ActionEvent e" and you are trying to call it with no parameters. There is no method signature [icode]actionPerformed_Plus()[/icode] defined. | |
Re: Obviously the point of your homework is for YOU to come up with a solution. Handing you the solution defeats the purpose. Post your code and describe what troubles you are having if you would like assistance. ![]() | |
Re: The problem is that here[code]if(itemCount == item.length) Doll [] temp = new Doll[item.length * 2];[/code]you are just declaring a variable - not performing any useful operation. That variable will go out of scope immediately after it's declaration. I think what you actually want is this block[code]private void cpyArray() { if(itemCount … | |
| |
Re: [QUOTE=sneekula;508638]Nationally, a vaginal delivery cost $7,737, with C-sections averaging about $11,000.[/QUOTE] Well, that first one will certainly be quite a shock when you answer the doorbell :-O | |
Re: Well, which one has no context without the other? Does a listener have any useful function without a GUI? What about the GUI? It seems to me the GUI can exist without a listener, but it just won't do much until it has one. So you could create the GUI … | |
Re: No, it's not a warning - it's an error. Apparently they removed the compareTo(Object) signature from the String API. You could either cast the elementAt() to String or explicitly call toString() on it. | |
Re: Post the code that you have and what problems you are encountering. Please put [ code] tags around any code you post. | |
Re: Yes, the idiom that masijade mentioned is one way to handle it. It's recommended that the boolean flag be declared volatile (i.e. [ICODE]volatile boolean canceled=false;[/ICODE]). Another way is use thread interruption. Here's a pretty good article on that: [url]http://www.ibm.com/developerworks/java/library/j-jtp05236.html[/url] | |
Re: Well, that selection call should work. Are you certain the TreePath includes all nodes up to and including the one you want to select? | |
Re: If your class implements the ListModel interface (which it does if you extend AbstractListModel), why not use the constructor [url=http://java.sun.com/javase/6/docs/api/javax/swing/JList.html#JList(javax.swing.ListModel)]JList(ListModel dataModel)[/url]? Edit: Nevermind, you posted the code while I was composing this. | |
Re: The number of elements in the ArrayList has nothing to do with the [I]type[/I] of those elements. You only need to specify the type. If need to type the contained ArrayLists but those can contain any type you can use [icode]<ArrayList<ArrayList<?>>[/icode], but if you are using mixed-type collections you might … | |
Re: You must be using a JDK prior to 1.5, because 1.5 and 1.6 will allow you to pass that Double in place of a double parameter (autoboxing). You can use Double.parseDouble(String) to convert direct from a String to a double primitive value without the need to first create a Double. … | |
Re: [QUOTE=reiyn17;510673]can you make a program for it? pls....badly needed,, im still not familiar with java.. can you help me?[/QUOTE] And obviously the whole point of the assignment is for you to [I]get[/I] familiar with Java - so make an effort. | |
Re: [QUOTE=Serunson;507215]Which no one knows when it will end....[/QUOTE] It can't end until those waging it decide to end it, as the definition of terrorism is subjective and malleable, rooted in ideology. Any violent act with which they disagree can be deemed "terrorism" and thus targeted. Violent actions which they find … |
The End.