7,116 Posted Topics

Member Avatar for Hari_13
Member Avatar for Violet_82

> I could get my validateInputs() to return a boolean value of false if an exception has occurred and true if it hasn't, pass that back to the caller and take it from there. Without going into all the details, that sounds like a good idea. In general it's a …

Member Avatar for Gribouillis
0
418
Member Avatar for Violet_82

I too had these problems when trying to access DW from my iPhone this afternoon. It insisted on all kinds of obtrusive offensive and and irrelevant questions before it would deign to let me get into DW to see if anyone wanted any Java help. I had to give random …

Member Avatar for Violet_82
1
440
Member Avatar for Violet_82

1. Yes. Swing calls paintComponent when needed. Resizing the container os one reason why a repaint would be needed. 2. rand.nextInt(255) returns a random int in the range 0-254, not 255. The Color constructor takes three values 0-254 representing the red/green/blue components of the color, so that whole code creates …

Member Avatar for Verse_1
3
5K
Member Avatar for Josh_2

Mixing stream types on a single socket is guaranteed to cause chaos, so pick one type and stick to it. Object streams are the obvious way to go because they are most capable and simplest overall. You can create a simple protocol to allow you to send different kinds of …

Member Avatar for Josh_2
0
1K
Member Avatar for Violet_82

Yes, you need to catch the NumberFormatException that's thrown when the user input is not numeric. > I would have thought that the InputMismatchException would take care of it No. When in doubt, read the API documentation, eg * public static int parseInt(String s) throws NumberFormatException Parses the string argument …

Member Avatar for JamesCherrill
0
405
Member Avatar for Judi Almed

By calling a method that either accepts the variable as a parameter, or returns it. Doesn't matter if its a simple value, or an array, or whatever.

Member Avatar for JamesCherrill
0
81
Member Avatar for hhappak

> The text file can become very large and opening then closing it, then opening it again to start reading the updates is highly inefficient and I am searching for an alternative. I guess you missed that? (not to mention this thread has been dead for 6 years)

Member Avatar for rproffitt
0
5K
Member Avatar for Kriti_1

Hi Zaraki (and Kriti) Please note that it is DaniWeb's policy that posters should show some effort before we give them help. "Please do my homework for me" posts are usually either ignored or penalised. Having said that... Z's post is good in that it points OP in the right …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Judi Almed

When you call `parseDouble` passing a string that cannot be parsed as a number Java will throw a `NumberFormatException` You can put your `parseDouble` inside a `try` block and `catch` the exception - your catch block will be executed if and only if the string does not represent a valid …

Member Avatar for Judi Almed
0
212
Member Avatar for nitin1

I thought this question was how to handle a Java Object (that happens to be a Boolean) in cpp code? If it's a Java question then you need to cast the Object to Boolean (maybe checking first that it is an `instanceof` Boolean). Java will handle conversion between a Boolean …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Altjen_1

There are all kinds of algorithms that come under the heading "self learning software". You can write any or all of them in C# or Java Your question is far too vague and large to expect anyone to try to answer it in its current form. I suggest you spend …

Member Avatar for JamesCherrill
0
621
Member Avatar for Tre Sivileo

Try printing sqlString to check its syntax. Run that exact string at an sql prompt and see what it does.

Member Avatar for Tre Sivileo
0
371
Member Avatar for vishal_13

If you input 3 is the output wrong or right - you say both! 11 and 17 are also prime numbers

Member Avatar for rubberman
0
57
Member Avatar for Dani
Member Avatar for Pardeep_1

Java GUI, Socket communications, multi-threading, video compression... This is a complex application that requires a wide range of skills. Perhaps you should do something simpler first.

Member Avatar for JamesCherrill
0
42
Member Avatar for nadiam

OK, a couple of observations... when you click menu you don't reset `value` what is `iterate` all about??? to stop falling off the end of the array you just need to test for it, ie (pseudo code) `if value = last element in array: do nothing` `else display array[++value]` ps: …

Member Avatar for JamesCherrill
0
424
Member Avatar for sup_1

Class names usually begin with a capital letter, eg Connection. (Java is case-sensitive) Re your `catch` block: 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 …

Member Avatar for JamesCherrill
0
1K
Member Avatar for nitin1
Member Avatar for meron seyoum

I've been programming since 1969 and I don't know how to use them properly either. Neither do the combined resources of Microsoft, Adobe etc, judging by the number of memory-related security errors that they keep finding in their released code. Pointers are far too error-prone and dangerous for anyone other …

Member Avatar for rubberman
0
319
Member Avatar for Mar. Na.

Inside your nested loops just use the `equals` method to compare `t[i][j]` with the target string.

Member Avatar for Mar. Na.
0
1K
Member Avatar for filipa_1

If you really understand nothing then you may as well give up now. But I suspect you know more than that. You have been told what to do step by step. Start at the beginning, do what you can, and when you get stuck post what you have done, and …

Member Avatar for JamesCherrill
0
175
Member Avatar for Danilo_3
Member Avatar for sangatik

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrespectful 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 AssertNull
-4
302
Member Avatar for Doogledude123

Can you explain further? Once you have set up the socket connection you have two Streams available (one going each way) so either end can send whatever it wants to the other. What is worrying you exactly?

Member Avatar for JamesCherrill
0
378
Member Avatar for yogi21

Do you think this is a free "we do your homework" service? Stop trying to cheat, an do your own homework. If you try, and have a problem, come back here, show what you have done, and explain what help you need.

Member Avatar for JamesCherrill
-1
195
Member Avatar for daniel955
Member Avatar for Ankit_22
Member Avatar for Brian_18

> In other words how would your new formatter know the end of a comment? It would have to make guesses such as "Hmm, a // might end when I find ???" I get the feeling an AI class would have to be made. The JLS specifies Java's syntax with …

Member Avatar for JamesCherrill
0
453
Member Avatar for screenedcreamy

You probably don't need the full power and complexity of Java to do this. A simpler scripting language will probably do. I've tagged this post with a javascript tag so it will be visible in the appropriate forums. JC

Member Avatar for JamesCherrill
0
190
Member Avatar for Brian_18

1. What is the printLine method for? Why not just print the text? 2. The printLine method is where you always print a blank before every line 3. Your code does not handle the case where there is more than one } or more than one { on any one …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Bobonoinc

Instead of drawing directly to the panel's Graphics, create a new Image and draw to its Graphics. Then just copy that to the panel using `drawImage` and also save it as a jpeg ps: Updating the random numbers inside paintComponent is a really bad idea. You have no direct control …

Member Avatar for Bobonoinc
0
286
Member Avatar for nadiam

Yes. `private` fields can only be accessed within the class where they are declared. You need a less restrictive access type such as `protected` or *`default`*. This tutorial expalins it better than I can: http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html ps Lines 11/12... because a superclass's variables have to to be initialised before its subclass's …

Member Avatar for jacks009
0
245
Member Avatar for reynaud0000

As far as I can see that code should return the department name followed by the number of staff in that department (or "" if there are no staff in that department), and it will always return exactly the same result unless you are changing the contents of `staff` outside …

Member Avatar for reynaud0000
0
410
Member Avatar for DS9596
Member Avatar for jacks009
0
310
Member Avatar for lo022

Seriously? You want us to help with an error in your code, but you don't tell us what the code is or what the error message is? We're not mind readers.

Member Avatar for JamesCherrill
0
172
Member Avatar for Rajesh_21

If you are a beginner (which is obvious from the question) then forget Eclipse. Eclipse is a very powerful massively complex tool for experts. It has its own learning curve every bit as long as the learning curve for Java itself. Just download the JDK from Oracle, find a text …

Member Avatar for Gribouillis
0
195
Member Avatar for Saboor880

You could build a simple form with an entry fields (or drop-down lists) for each column in the database. Whatever the user enters you use as search criteria. You could have a check box next to each field, and if it's checked you summarise the results by summing over each …

Member Avatar for JamesCherrill
0
232
Member Avatar for Square50

I tagged this "java" so the right people wil see it. Show what effort you have made so far. What the heck does "one toss of a die is equivalent to one experiment. In one experiment a die is rolled 50 times." mean?

Member Avatar for jacks009
0
195
Member Avatar for divinity02

We don't have tutorials as such here - mostly because there are so many tutorials on the web already. As always I recommend the original Sun/Oracle tutorials. They are the most complete, the most correct, and the most up-to-date. http://docs.oracle.com/javase/tutorial/reallybigindex.html

Member Avatar for divinity02
0
477
Member Avatar for ALV_IR

You are nearly there. In the client, do not calculate the surface. Send the radius and the height to the server. Wait for the reply and extract the area from that. In the server, extract the radius and height from the received message. Calculate the area. Send the area back …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Mar. Na.

Sorry, but this makes no sense at all. Are we talking about files or classes? Can you give more details or better examples?

Member Avatar for Mar. Na.
0
458
Member Avatar for can-mohan

Before doing a lot of work, and possibly constructing harder-to-maintain code, maybe you should check your assumptions? How about a trivial program to create and detach 1,0000 threads and see how much CPU that actually takes relative to all the other stuff that's needed to service each request. Shouldn't take …

Member Avatar for can-mohan
0
219
Member Avatar for behram kazmi

That question is not clear. Please explain your question with more details.

Member Avatar for JamesCherrill
0
85
Member Avatar for enakta13

In Java char is a 16 bit unsigned numeric value, so zero is perfectly valid anywhere, but the Java equivalent of your loop wold be something like `for (int i = 0; my-char-array[i] != 0; i++) {...` of course that will give an array index out of bounds if the …

Member Avatar for Stungkuling
0
16K
Member Avatar for m.a.x

Because it was 4 years ago, and the people involved are no longer here, all the info we have is in this thread. If you now have the same problem, or a similar one, please start your own new thread and someone will help.

Member Avatar for JamesCherrill
0
1K
Member Avatar for glao
Member Avatar for glao
0
131
Member Avatar for Doogledude123

Are you trying to create code that will run something with elevated privileges without the user needing to input an admin password?

Member Avatar for Doogledude123
0
4K
Member Avatar for BabaRoro

You are using classes that are not part of standard Java, and so we have no documentation for them. In general you can't cast to a primitive type (int etc) because these are not classes. Only their corresponding classes (Integer etc) can be directly converted to primitives by Java ("unboxing"). …

Member Avatar for BabaRoro
0
307
Member Avatar for Roger_2

Having a method and a data member with the same name `adj` is bound to lead to confusion.

Member Avatar for JamesCherrill
0
552

The End.