- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 15
- Posts with Upvotes
- 14
- Upvoting Members
- 10
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
76 Posted Topics
Hi All, I need some help with analysing a problem. I have a list of objects that are retreived as part of search results in my webapp page. From the list of these objects, one object is selected and the next screen is populated with the data from this object. … | |
Re: If you could afford more memory to your JVM on the server machine. You could increase it. This reduces the chance of OutOfMemmoryError. May be you could also use a profiler to confirm that there has been no memory leaks in your application ? | |
| |
Hi, [CODE] public void getTasksList(ArrayList<PerformTask> TasksList) { // TODO Auto-generated method stub try{ Class.forName("com.mysql.jdbc.Driver"); Connection cn=DriverManager.getConnection("jdbc:mysql:///test","root", "admin"); Statement st= cn.createStatement(); String s1 = "Select * from perform_task"; ResultSet rs = st.executeQuery(s1); System.out.println("Comes Here !! "); while(rs.next()){ rs.getDate("DateOfTask"); java.util.Date jDate = new java.util.Date(rs.getDate("DateOfTask").getTime()); TasksList.add(new PerformTask(rs.getInt("TaskID"), rs.getInt("PersonID") , jDate ,rs.getString("TaskDescription"),rs.getInt("TotalEffort"),rs.getString("TaskName"))); } }catch(Exception … | |
Hi All, I've the following scenario which i am not sure can be implemented. I have my Client Side Objects, which have been defined at an earlier stage. Now i need to send the data in the form of XML to the server side who have given me XSD's. Now … | |
Hi, I'm not quite sure if there is a thread for Eclipse related query separately. But since this is a java related one. I'm posting it here. Is it possible that i can have PMD check run on a project by default ? Instead of clicking on my source file … | |
Hi All, I have a JAR file that contains a .dll file. But during an ant build a ZIP Error is thrown [CODE]error reading D:\COE\Libraries\client\WSQUtil-1.0.jar; error in opening zip file[/CODE] Is there a way to overcome this ? The jar looks fine(opens in winzip) and eclipse build path also references … | |
Hi All, I need to have a Regex that will not allow just spaces, but it can allow sentences with spaces. It should allow any special characters that occur as well. Actually, it is for a text area of comments. So i want to restrict him from entering just spaces. … | |
Re: Did you write this code ? I think there are way too many mistakes here. Write the class properly. There are repetitions of variables. Also use functions to write your code. Probably then, we can think of writing the functionality that you want. An example, [CODE]public class A{ private int … | |
Re: I don't find the error that you stated above. Can you paste the code that you used. And the full exception message. @above. It should throw a FileNotFoundException in case the file is not found in the String sent. He has passed a string. I see no issue in that. | |
Re: I think you can do this to help your case. [CODE]while(scanner has lines){ //get line into a string variable from scanner Scanner secondScanner = new Scanner(line); while(secondScanner has integers){ //read numbers into array here. } secondScanner.close(); }[/CODE] | |
Re: For [CODE] length frequency ------ --------- 1 3 2 13 3 24 4 13 5 10 6 2 7 5 8 3 9 1 10 3 11 2 > 23 0 ------ --------- Average length = 4.2 [/CODE] I would like to see length and frequency as key-value pairs in … | |
Re: Well, what you have used is correct functions of String. If it works for you, its great. but i have a question. Why do you need four sets of [CODE]String type, asked, ans;[/CODE] to perform the same operation. Once a set of values required for your quiz object is ready. … | |
Re: For Java specifically. i prefer Head First Series Java. For android, please check mobile development forum in this same site. Happy learning!! | |
Re: Yes. First, add suit and number to your card class. Move the generation part to a tester class. Essentially programming should be a way such that the single functionality performed in a function. Here you could, 1.Have a method to generate random number separately. 2. Pass the random number from … | |
Re: As JeffGrigg told you. Open Source third party tools are a good option. Apache POI is good and i feel its the best. | |
Re: You have a constructor which takes 3 params [CODE]public Account(double initBal, String owner, long number) { balance = initBal; name = owner; acctNum = number; numAccounts++; }[/CODE] But you try to use a constructor which has two parameters. [CODE] Account consolidatedAccount = new Account(0, acct1.name);[/CODE] Your error message says exactly … | |
Re: Yes setting the value of a variable using a setter is the best way . But then you do not return a boolean value. Setter should not return a value. It is against programming conventions. [CODE]public void setmyYVar(int y){ if(my_condition_is_true){ this.y = y; }else{ //do nothing or set a pre-defined … | |
Re: continue and break are for loops. Not for condition statements. | |
Re: [CODE]Scanner scanner = new Scanner(myFileWithLineNumbers); while(scanner.hasNextLine()){ String line = scanner.nextLine(); line.substring(1, line.length()); }[/CODE] This is one such small snippet of code. Assuming you have single digit numbers. There will be variations when you try to add this in your code fully. May be your line number has a "." at … | |
Re: It would be nice if your code is enclosed by code tags. Its not at all readable. | |
Re: More inputs from you would do us good. Show us the piece of code that you are using to execute the query. One Example may be -- Where i assume query is what you are running from your java program. [CODE]List mylist = query.list();[/CODE] | |
Re: I do not know about best sites. But i suggest Head First Series in Java as a good place to start. It is a very good book. Ohh.. I almost forgot. You get a good documentation if you download java onto your machine which is also available on their site. | |
Re: Try using the[CODE] .equals()[/CODE] method on the first String. It would be good for you to investigate why [CODE]== [/CODE]is not used for Strings. | |
Re: Which line is throwing the NPE ? That will specified right next to the exception. ![]() | |
Re: First there are lots of typo's in your program. Remove them. Your class cannot return an int. Your method should [CODE] public class void MyClass{ public static int myOddNoSumFunction(args){ // functionality } public static void main(String[] args) { myOddNoSumFunction(myargs); } } [/CODE] Note the usage of static. Try the same … | |
Re: i'm not sure why you need this loop. [CODE]while (maxVal > userInput) { maxVal = maxVal/10; }[/CODE] What i would do for this is [CODE]1. Get input from user. //Inside a loop now, 2. userInput % 10 , Print remainder 3. userInput = userInput/10 //exit loop [/CODE] Given so many … | |
Re: This should not work slow on the PC configurations you mentioned as this just a very basic program. Is this the entire program or is there any other calculations or looping done ? | |
Re: I'm not able to see any error in the program as such. But this should take a long time to get you the answer. Because basically you are iterating 3 inner loops 10000 times and also the third loop is almost called four times for each run of the second … | |
Re: Download at [URL="http://www.oracle.com/technetwork/java/javase/downloads/index.html"]http://www.oracle.com/technetwork/java/javase/downloads/index.html[/URL] | |
Re: [CODE]String[] studentName = course.getStudentName();[/CODE] Now iterate through this array. Use an Enhanced For loop. Its better. I think you are now printing the entire array of students thrice. @above. I feel it is an assignment for them to create a course class. | |
Re: @hfx642: To add to what ezzaral said, variable is not available is correct , but then you may pass it as a parameter , even when you pass that as a parameter, since u say it has been initialized, it will not throw a NPE,unless you specifically initialize it to … ![]() | |
Re: Are you getting any errors or is the program not running as you expect it to ? | |
Re: I guess you may have to use an overloaded hashcode method for this to work. I'm not quite sure though. May be the more experienced people can help you out. I have a few questions out of curiosity : 1. Can it not be the other way around ? You … | |
![]() | Re: Catch all the exceptions that are thrown.NumberFormatException is thrown appropriately here as you are trying to parse a character to integer. Catch that as well !! |
Re: Look for a concept called NumberFormat in Java. It will solve your issue. | |
Re: You will have to learn the concept of a stack first. It will be a little difficult to explain a concept of a stack, as it is best understood with pictures and graphics !! Each function call is assigned a new stack frame with memory for its local variables. Try … | |
Re: The error is because of concept of polymorphism. In line 33 that you specified , cam is a super class, while megapx() is present in a sub class. Your super class variable can hold the reference to a suclass object but it will not know the functions or variables present … ![]() | |
Hi, I was preparing for SCJP 1.6 and i have the following snippet of code. [CODE]package com.self.trials3; public class Animal { public void Animal(){ System.out.println("Obviously Works"); } Animal(){ //System.out.println("Constructor"); //super();use super or this() as first line in your cons to call other //cons. this("Adarsh"); } Animal(String AnimalName){ //System.out.println("AnimalName >> "+ … | |
[CODE] insert into AUDIT_TABLE( "TIMESTAMP", AUDITCATEGORY, USERID, AUDIT_XML, "AUDITID", "SOURCE", "ROLE", EVENT_ID, EVENT_DATA, TYPE_OF_APPLICATION) select CURRENT_TIMESTAMP, AUDITCATEGORY, USERID, AUDIT_XML, (SELECT MAX(AUDITID)+1 FROM AUDIT_TABLE), dummyNumber||i, "ROLE", EVENT_ID, EVENT_DATA, TYPE_OF_APPLICATION from AUDIT_TABLE where "SOURCE"='1312171509321'; [/CODE] Hi, Above is a part of my stored procedure , I'm trying to create test data for … | |
Re: a goto statement isnt tat good for programming.. avoid it if possible.. this program becomes pretty simple without em.. | |
[CODE]import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTest { public static void main(String[] args) { String regex = "([a-zA-Z'-]*[ ]*)*"; Pattern p = Pattern.compile(regex); String input = "Adarsh has been testing this issue for a very long time now!#!"; Matcher m = p.matcher(input); System.out.println("Called"); if(m.matches()) System.out.println("Matched"); else System.out.println("Not Matched"); if(input.matches(regex)) System.out.println("Matched"); … | |
Re: "The question is required to use arrays to display what the user has entered when they select choice 4 " @above Do you want to display all the previously entered choices by a user when he finally presses 4.? | |
Re: MS Visual Express C++ is just around 70 mb. The entire Visual Studio Express is that big. You can download only the C++ component. | |
Hi all, I've this following piece of code. It is a simple hands on exercise for my learning. I retrieve data from a table called cat and what i would like to do is , go to the action page only if there is a record for that username and … | |
Re: don't use [CODE]for (i = 0; i <= odds.length; i++)[/CODE] Use [CODE]for (i = 0; i < odds.length; i++)[/CODE] The array subscript for the last element is one less than array.length | |
Re: Well !! I went through your code, it does have a problem. I feel its more simple and i don't find the necessity to run through a loop since you have the pointers for the first and the last one. What can be done is You have [CODE]1->2->3 Store 1 … | |
Re: Just type it like this in the console. java progname filename | |
Re: The braces are incorrectly laid out. Try using a better editor. It shows you where the braces are wrong and one more thing , when multiple statements have to be executed for a set of conditions , braces have to be there. You have not used them anywhere. | |
Re: [QUOTE]Good point, I moved those to the constructor called showListing,[/QUOTE] 1. You cannot call a constructor by any name. It has to have the same name as the class. [QUOTE]What do you mean TVShow objects instead of an array of Strings?[/QUOTE] 2. Create an array just like you do so … |
The End.