1,171 Posted Topics
Re: >I want to know how can I return ArrayList You are actually doing this already. In the code that you posted on line 4 you let `res` be a reference to a List, and set it to refer to an ArrayList. On line 20 you have `return res;` which will … | |
Re: >Also my print format doesnot display the $ and the headers. Take a look at the [DecimalFormat](http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html) class. >I need the year 1 to be the initial value without doing the percent first Print out the balance before adding the interest to it. Are you required to use loops? | |
Re: You can never obtain the exact value of PI, you are always bound to the limitations of memory and computation time. Also a perfectly correct answer is not always needed in all circumstances. Therefore it makes sense to determine how correct you want the answer to be and use an … | |
Re: >i dont know how to create tables in sql but i have make account hope u will come to help me i send you email ... :) Congratulations, you just limited your chances of getting good advices. In this context email is far less productive to get answers than a … | |
Re: I remember [this](http://www.daniweb.com/software-development/c/code/216515/checking-for-integer-overflow) snippet from [Dave Sinkula](http://www.daniweb.com/members/5020/Dave-Sinkula). | |
Re: In addition: don't forget to [close the file](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html). | |
Re: >I know how to read file from data and split each line using array Then I fail to see what the problem is. Pretty much the same question as [your other thread](http://www.daniweb.com/software-development/java/threads/446764/reading-data-from-file-to-arraylist). [This post](http://www.daniweb.com/software-development/java/threads/446764/reading-data-from-file-to-arraylist#post1927976) should get you started. | |
Re: It all depends on how you read your number: if you read it in as int, use the modulo 10 divide by 10 approach. On the other hand if you read your number as a String you can either loop through all characters in the String and convert each character … | |
Re: >is it nessasary to use regular expression concept to get your actual output? >may i suggest any alternate solution to your requirement? >isn't it good to use split() for this requirement? What do you think [split()](http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)) uses? Here's its signature: `public String[] split(String regex)` API: *Splits this string around matches … | |
Re: You probably didn't set your PATH variable correctly. | |
Re: >it won't be an 2d array anymore I can't go something like 'matrix[i][j]')? Anybody have any ideas, or am I approaching this completely wrong? While in other languages such as C# or C++ you have operator overloading, there's no such feature in Java. Your best bet is creating a method … | |
Re: It is basically the same as counting in base 4. | |
Re: I know I am nitpicking, but the backslashes need to be doubled in: `mkdir("c:\one\two\three")`. | |
Re: Instead of defining the name attribute as of type `char *`, I'd define it using the **std::string** type instead. | |
Re: >please correct the problem with the Braces... What do you mean by "problem with the braces"? Are you referring to code indentation? If so, run your code through a code formatter / code beautifier. If you're using an IDE look if there's an option available, most IDEs come with a … | |
Re: *File* -> *Import* -> *Existing Projects into Workspace* (under *General*) -> *Next* -> *Select root directory*: use the *Browse...* button and browse to the Workspace directory which contains the projects to be imported. -> from the *Projects* list select the projects you want to import into the Workspace (or use … | |
Re: What is the type of your variable? Does the output file have to be *human-readable*? | |
Re: The following lines are causing compilation errors: // lines 16-19 program.main(arg[0]); // line 16 program.main(arg[1]); // line 17 program.main(arg[2]); // line 18 program.main(arg[3]); // line 19 You declared `arg` as follows: String[] arg = new String[4]; // arg is a reference to a String array On lines 16-19 you index … | |
Re: [About printf and sizeof #1](http://www.daniweb.com/software-development/c/threads/224617/converting-hex-to-decimal#post992334). [About printf and sizeof #2](http://www.daniweb.com/software-development/c/threads/224617/converting-hex-to-decimal#post992369). | |
Re: What exactly do you mean by *vector*? Do you mean the [Vector](http://docs.oracle.com/javase/6/docs/api/java/util/Vector.html) class? [ArrayList](http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html) is much more common nowadays, prefer that container class over Vector. As stated in the API: *This class is roughly equivalent to Vector, except that it is unsynchronized.* Also you don't need a loop, you can … | |
Re: Add a PATH entry for the *bin* directory of your JDK installation. For example if your JDK's *bin* directory is located at `C:\Program Files\Java\jdk1.7.0_10\bin` Then you'd add that to your PATH like this: *C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common; %SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem; %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; C:\Program Files (x86)\Toshiba\Bluetooth Toshiba Stack\sys\; C:\Program Files (x86)\Toshiba\Bluetooth Toshiba … ![]() | |
Re: In addition: don't forget to deallocate the memory ;) | |
Re: Already looked [here](http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq)? | |
Re: @AD: toupper() and tolower() seem to return int and not char. Also if I recall correctly C++ has new style headers: `#include <cctype>`. | |
Re: The quick and dirty way to fix it would probably be creating a separate instance variable to help in the recursion. **Edit: Bad approach, don't use it. See later posts.** | |
Re: I am wondering if the Builder pattern would be a candidate for being applied here? Let me know your opinion. | |
Re: Your algorithm is more complex than it should be, compare with the following: iterativeInorder(node) parentStack = empty stack while not parentStack.isEmpty() or node != null if node != null then parentStack.push(node) node = node.left else node = parentStack.pop() visit(node) node = node.right (Source: [Tree Traversal - Wikipedia](http://en.wikipedia.org/wiki/Tree_traversal)) | |
Re: This is probably caused by your default locale setting for a decimal separator (which is probably a comma instead of a point). More info: http://docs.oracle.com/javase/6/docs/api/java/util/Scanner.html#localized-numbers | |
Re: [Apache POI](http://poi.apache.org/spreadsheet/index.html), recommended two weeks ago in [this post](http://www.daniweb.com/software-development/java/threads/444012/read-from-text-file-and-write-to-excel#post1912524). | |
Re: Did you put a component scan into your beans configuration file? More info: http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch04s12.html | |
Re: Yeh, but be careful for "micro-managing exceptions", sometimes you need to put a statement that doesn't throw an exception in a try block to guarantee that it won't execute if an exception is thrown from another statement that comes earlier in that try block. However, apparently the OP deleted the … | |
Re: The following Java books are on my shelf and I consider them as very good: (haven't read these cover-to-cover though) * Kathy Sierra & Bert Bates - Head First Java: Introductory Java book * Elisabeth Freeman & Eric Freeman & K.S. & B.B. - Head First Design Patterns: Good read … | |
Re: Aaand.....What exactly do you mean by "not running properly"? | |
Re: In the Java Language Specification I read the following: "The result of a floating-point division is determined by the specification of IEEE arithmetic:" ... "Division of a nonzero finite value by a zero results in a signed infinity." (Source: [JLS - 15.17.2 Division Operator](http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.17.2)) | |
Re: It's also possible using two HashSets, one that keeps track of the elements that occur only once, and another that keeps track of the elements that occur more than once. At the end you check the size of the first HashSet, and if it is not empty you know that … | |
Re: Did this compile? This is the C forum. void alterValueTwo (int& input) | |
Re: @vijayan121: Any specific reason why you chose to recurse on Problem 1 - Line 11? If the user enters a wrong input 5 times, then that function will return 6 times. I would suggest a do while to avoid that. | |
Re: Read the [rules](http://www.daniweb.com/community/rules) and make sure you understand them. After that if you're still interested you could come back, reformulate your question and post your own attempt and point out which difficulties you are facing. | |
Re: >does he mean incorporating arrays and such? Why are you asking us and not your teacher? As it stands now it's a bit of a mess... * You're using unportable stuff like conio and [system("cls")](http://www.gidnetwork.com/b-61.html). * Try to replace the recursion in your input routines by iterative constructs. * Remove … | |
Re: Your question seems pretty vague to me. However you could keep a copy of the initial game state somewhere and restore it when the game needs to be restarted. There are different ways to restore to the initial state of the game, and which one to pick depends on the … | |
Re: Line 19 - `scanf("%c",&ch);` This is overkill ([reason](http://www.gidnetwork.com/b-60.html)). | |
Re: >i'm wanting to do separate programs for each (aka one program for adding one for subtracting) is this possible? Yes. | |
Re: You're taking input as a string: `scanf("%s",&array[i]);`. | |
Re: > you can download dos-box turbo c++ from internet. it will work on all versions of window including win 7 and win 8 also > > try it now Why doing so many effort for something that is worse? | |
| |
Re: There's no need to write your own logger. There are frameworks available for that. If you're interested, you might want to take a look at these links: * [java.util.logging (JUL)](http://docs.oracle.com/javase/6/docs/api/java/util/logging/package-summary.html) * [Apache log4j](http://logging.apache.org/log4j/2.x/) * [Logback](http://logback.qos.ch/) * [Simple Logging Facade for Java (SLF4J)](http://www.slf4j.org/) | |
Re: You're using Eclipse for Java EE Developers right? *Window > Preferences > Server > Runtime Environments > Add > **Download additional server adapters*** (link) | |
Re: @Override public void actionPerformed(ActionEvent ae) { double p = Double.parseDouble(pricefield.getText()); double d = Double.parseDouble(discountfield.getText()); double sum = 0; while (p < sum && d < sum) { sum = p * d; calc.setText(sum); } } You initialize sum to 0, hence if you enter a value bigger than zero in … |
The End.