7,116 Posted Topics

Member Avatar for luan.augusto.9081

You downloaded a compiled program, decmpiled it with the intention of changing it in order to put it online? This sounds too much like a copyright issue. Do ensure you own the intellectual property rights to everything that you post Do not post copyright-infringing material Do not ask for help …

Member Avatar for JamesCherrill
0
283
Member Avatar for nikolaos
Member Avatar for JamesCherrill
0
691
Member Avatar for benjo.s.lucas

At the start you don't know how many evens and odds there may be, so you can build up two Strings as you process the numbers and print them only at the end - like this pseudocode: evens = "", odds = ""; for each number in the input { …

Member Avatar for benjo.s.lucas
0
123
Member Avatar for Madiya122

Java is case-sensitive. string and String are not the same. String is a class name and is spelled with a capital S

Member Avatar for Madiya122
0
509
Member Avatar for ahmed.talha.16

If OP really doesn't have sufficient ability or initiative to find information on prime number programs on the web then simply giving them something to copy & paste into their homework is helping nobody. Not their teacher, not a potential employer, not their hard working colleagues, and least of all …

Member Avatar for uttkarshsing
-1
345
Member Avatar for techxaidz

Your random numbers are in the range 0-12 so your first loop will never be able to process 14 letters, but it keeps on trying... Ps. Your second loop will never select Z, for the same reason. It seems you have mistaken the contract for nextInt - review the API …

Member Avatar for techxaidz
0
326
Member Avatar for Benjamin_4

Since your resultSetToTableModel isn't part of the standard Java API its hard to know how solid it is. Did you try printing from your result set to confirm that it has some data in it?

Member Avatar for JamesCherrill
0
213
Member Avatar for ahmed.talha.16

As Oracle keep improving Java, there are times when old classes and methods get replaced by newer better versions. The old versions are still there, so existing programs will continue to work, but they are marked as "deprecated" to tell programmers that they should replace or upgrade their code. If …

Member Avatar for jwenting
0
318
Member Avatar for Smith6969

You ask rhe user for a number between 0 and 1.00, but you read his reply as an int - which has no decimal places

Member Avatar for JamesCherrill
0
188
Member Avatar for aminem2080

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 Post what you have done so far and someone will help you from there.

Member Avatar for JamesCherrill
0
27
Member Avatar for Kuroshi

the get and the remove are not nested, so you don't multiply them together. Think of it as O N*(N+N) ie O N^2 (Of course, if the list implementation is suitably optimised then get(i+1) immediately following a get(i) could be constant and small. Similarly get(i) followed by remove(i) could be …

Member Avatar for JamesCherrill
0
81
Member Avatar for vivosmith

You changed adding the label. You add yours at the default location (CENTER), which is where the paint area was. The original code adds it at SOUTH so there is no clash. ps: Next time please provide a lot more info to describe your problem, eg exactly what do you …

Member Avatar for mKorbel
0
372
Member Avatar for woochoi24
Member Avatar for JamesCherrill
0
3K
Member Avatar for Benjamin_4

As far as I know you can't insert into two tables with one SQL insert statement, so you need to prepare two statements, set all their strings, and execute them both. You may need to wrap them in a transaction if you are worried about database integrity after a partial …

Member Avatar for Benjamin_4
0
3K
Member Avatar for SAM2012

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

Member Avatar for masijade
0
92
Member Avatar for jmartzr1

Forget Java for a moment. Get a sheet of paper and a pen and work through a simple example (eg array length 3) by hand. That will get the algorithm clear in your head, and you will find it easier to convert that into Java code.

Member Avatar for JamesCherrill
0
234
Member Avatar for djslavens

Are you looking for books etc, or do you have books etc that you want to promote?

Member Avatar for JamesCherrill
0
68
Member Avatar for Nawaf15

You have not defined a drawPool method, swo obviously you cannot call it! You need to write a method that will use one or more draw... methods from the Graphics class to draw the pool cross-section - eg call *drawLine* four times to draw the top surface, botton, deep end …

Member Avatar for JamesCherrill
0
182
Member Avatar for qwerty14444444
Member Avatar for cakka

All you need to know is: it's optional to catch an unchecked exception; if you do catch it you execute whatever is in the catch block; if you don't catch it it is thrown back up to the method that called the current method. eg When april calls e if …

Member Avatar for JamesCherrill
0
307
Member Avatar for lena1990

Well, OK, you can do that. If this is a follow-on to you still unsolved "handling large files" topic then messing about with how you read the logs isn't going to make any real difference - it's the SQL that needs to be optimised. You may get the best throughput …

Member Avatar for lena1990
0
132
Member Avatar for F_1

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 jwenting
-2
319
Member Avatar for Fatima_110

It's hard to see how you could get a divide by zero when k starts at 2 and goes up... try putting some print statenents into that loop to show the values of randomNumber and k so you can see what's happening.

Member Avatar for jwenting
0
303
Member Avatar for lena1990
Member Avatar for lena1990
0
338
Member Avatar for wallet123

> java.lang.StringIndexOutOfBoundsException: String index out of range: 1 > at java.lang.String.charAt(Unknown Source) > at app.SearchByKey.SearchStudentNumber.SearchStudentRecordReader(SearchStudentNumber.java:38) That's not a null reference. It's an attempt to get a char from a String that doesn't have enough characters in it. Specifically you are trying to acccess the second character (index number 1, the …

Member Avatar for JamesCherrill
0
433
Member Avatar for java_programmer

Don't confuse variables and objects; your example contains both. `List<Integer> lst` declares a variable. It's a reference, just a few bytes regardless of what it refers to. If it's a local variable it will be allocated when it comes into scope and released when it goes out of scope. If …

Member Avatar for jessicarobort
0
248
Member Avatar for faisal6621

You need to study how viruses work first, then look at how existing antivirus programs work. Its not easy, and needs a really deep understanding of the operating system. In any case, Java is completely the wrong tool for this job. It's designed to be independent of any one operating …

Member Avatar for JamesCherrill
0
742
Member Avatar for iTechnnn

You are looking for "cat ", so if the input is "cat" it won't match. Anyway, your algorithm would also find "muscat ", so it's not perfect. You are using Scanner's next() method - what happens if the input is more than one word? Line 11 doesn't do anything (more …

Member Avatar for masijade
0
518
Member Avatar for Petranilla

Never NEVER *NEVER* do this when writing new code: } catch (Exception e) { } If/when there is an error you just told Java that you didn't want to know anything about it, and please discard the detailed error message that Java just created for you. ALWAYS put an e.printStackTrace(); …

Member Avatar for Petranilla
0
346
Member Avatar for Louie_Rave
Member Avatar for Louie_Rave
0
255
Member Avatar for kylealb007

You didn't say what your qestion/problem was. But if that's one file... every public class must be in its own .java file, and the name of that file must be the name of the class. You therefore cannot have two public classes in one file.

Member Avatar for JamesCherrill
0
164
Member Avatar for lena1990

What do you nean by a "long time" - how many lines per second is it averaging (very rough answer is OK)?

Member Avatar for JamesCherrill
0
190
Member Avatar for YumnaZia

You are using a null layout manager for some reason - I suppose you are aware that this kills your portability - as soon as you run the code on any other machine with a different screen res / font size your text won't fit properly. Anyway, getPreferredSize is called …

Member Avatar for JamesCherrill
0
126
Member Avatar for student_learner

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
-1
109
Member Avatar for kay19

Lines 8,9,10 are redundant - a single Education object contains values for degree, major and research, so all you need is a single instance of Education - let's call that variable "education" for the moment, and assume you initialise it with a complete instance of each Faculty's Education. Now on …

Member Avatar for JamesCherrill
0
318
Member Avatar for stanislav.koshutin

Your code uses classes that are not in the standard Java API, so we have no way of knowing what the method calls do, or what the types of any return values are. That makes it near impossible to comment on the code. See http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html for a list of the …

Member Avatar for JamesCherrill
0
236
Member Avatar for Hanamantagouda
Member Avatar for JamesCherrill
-3
48
Member Avatar for xXFalcoPunchXX

Benjamin. I appreciate that you are trying ot help, but here at DaniWeb we try to help people learn Java and develop their Java skills. We do NOT do people's homework for them. Your post explains and teaches nothing. In future please help by pointing people in the right direction …

Member Avatar for JamesCherrill
0
364
Member Avatar for techxaidz

That all looks sensible. In general you need to test for null first, then if it's not null you can test for an empty String - if you want to treat a blank string as being empty, then use trim() first. getText returns a String, so the toString() is not …

Member Avatar for stultuske
0
171
Member Avatar for NajwaMY
Re: JDBC

Look through the messages until you find a reference to your code, in this case `at PBT$1.actionPerformed(PBT.java:103)` then look at that line `103 int pr1=Integer.parseInt(presentation1Tf.getText());` now you can undestand the error message `NumberFormatException: For input string: ""` presentation1Tf contained no text, and you tried to parse that as an int

Member Avatar for JamesCherrill
0
194
Member Avatar for android_gl

> is there better way to do this by using recursion? may be there is some formula that i dont know about. Instead of just `true/false` you could define the method to return three values for `to small/just right/ too big` (eg see the Comparator interface in the API). Then …

Member Avatar for cwarn23
0
327
Member Avatar for Lamirp

mKorbel: Hi. What's the easiest way you know to use a JFormattedTextField for the input in a JOptionPane InputDialog?

Member Avatar for mKorbel
0
7K
Member Avatar for EdwardVX

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 Post what you have done so far and someone will help you from there.

Member Avatar for JamesCherrill
0
594
Member Avatar for eldiablo1121

Hi Nikolas. Welcome to DaniWeb. eldiablo1121 is a beginner and has been struggling withy this assignment for some time. Do you really think that dumping 8 lines of highly compacted uncommented code is going to help him? In the worst case he will copy/paste/use that without understanding it, and thus …

Member Avatar for JamesCherrill
0
229
Member Avatar for Kuroshi

The API shows the nuber of bits in a BigInteger to be both set and returned as an int, so the limit is 2^31 bits. That is part of the public API conrtract of the class, and is thus guaranteed. (It should also be within the memory size of a …

Member Avatar for JamesCherrill
0
162
Member Avatar for eldiablo1121

The fully-qualified name of that class is `java.util.Arrays` so either use the fully qualified name, OR (and this is what people usually do) import it at the beginning of your program just like you did with ArrayList or Scanner `import java.util.Arrays;` ps all the java.lang classes (eg String) are automatically …

Member Avatar for eldiablo1121
0
2K
Member Avatar for cool_zephyr

You can also use System.getProperty to get the user's home directory (and other useful places) in an OS-independent way, so that may be a good way to specify a location that should work under any OS. http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

Member Avatar for JamesCherrill
0
303
Member Avatar for nikolaos

Yes. String's `format` method uses `java.util.Formatter` format specs (based on C's printf) to format data into strings with specified padding, decimal places etc etc etc

Member Avatar for nikolaos
0
935
Member Avatar for student.09

Hello rereye 1. Please do not hijack other people's posts for your question. Start your own new topic. 2. 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 Post …

Member Avatar for JamesCherrill
0
2K
Member Avatar for mikewyatt

That's a nice demo of using a panel in a standard dialog. Thank you. ps String password = new String(pf.getPassword()); if (password.equals("admin")) { test = true; } else { test = false; } OR just String password = pf.getPassword(); test = password.equals("admin");

Member Avatar for mikewyatt
0
157

The End.