4,084 Posted Topics

Member Avatar for creative_m

a reason why you yourself would/could use private constructors, is implementing the Singleton pattern. for instance, if your conection with your db should all be done with the same instance, you would have something like this: [Code=Java] public class ConnectionManager{ private static ConnectionManager instance = null; // other variables private …

Member Avatar for creative_m
0
472
Member Avatar for imsinu

an if statement, maybe not, an expression.. why not? remember, the expression of an if statement always will turn out to be a boolean. [Code=Java] public static void printResult(boolean b){ if ( b ){ System.out.println("the expression = true"); return; } System.out.println("the expression = false"); } public static void main(String[] args){ …

Member Avatar for JamesCherrill
0
4K
Member Avatar for webdragon89

write a method that determines whether a number is a prime number or not set counter to 0 set number to 0 loop while counter < 8 { number = number + 1; determine if number is a prime if ( true ) { print number add 1 to counter …

Member Avatar for hiddepolen
0
641
Member Avatar for sugir1987
Member Avatar for mehnihma

what exactly is your 'in'? if it's not a Scanner object, there's indeed something wrong with your code. also, I don't see any exception handling there. no doubt you're supposed to throw and catch an exception.

Member Avatar for zeroliken
0
281
Member Avatar for jade_91

[QUOTE=jade_91;1740758] [CODE] if (closest.name.equal("Wesston-On-Shore")); return ("Docks Line") [/CODE] not sure if this is correct plus how you 'name' it to recall in the display for the user any help would be appreciated[/QUOTE] well.. what is your method supposed to return, if anything? a few mistakes in the above lines anyway: …

Member Avatar for jade_91
0
122
Member Avatar for rotten69

keep a static int, in which you keep your index. if that int < the length of the array array[yourInt] = new Connection(); // NOT connectionManager, according to your assignment and then return array[yourInt]; if ( int >= length of the array) return null

Member Avatar for Philippe.Lahaie
0
259
Member Avatar for de.ICeman
Member Avatar for peter_budo
0
190
Member Avatar for rotten69

little remark about the original question, but I assume you figured it out already :) it's not the constructor <<I was just wondering why the constructor makes a call to the method toString() then I <<have realised that it's because of the method's name. the constructor doesn't make a call …

Member Avatar for rotten69
0
340
Member Avatar for scheppy

and you may want to add a return statement to your if. otherwise, it'll do all the iterations you know will be false, because you already found the one you needed.

Member Avatar for scheppy
0
372
Member Avatar for Melow
Member Avatar for skoon

no, we would be violating forum rules. you may want to take a close look at the first thread in this forum, it contains a lot of helpfull links and information to help you get started.

Member Avatar for Philippe.Lahaie
0
103
Member Avatar for jackbauer24

you can have unlimited classes in one file, but you can only have one public class in one file, and this class needs to have the same name as the Java file.

Member Avatar for jackbauer24
0
99
Member Avatar for hbluthi

what do you have in your main method? with this I mean: how have you tried to call your insert method? is this code all within one file, or separate files, ...? can you be a bit more specific?

Member Avatar for Philippe.Lahaie
0
196
Member Avatar for cloud02

did you Google read write file java yet? one of the results returned is [URL="http://docs.oracle.com/javase/tutorial/essential/io/file.html"]this[/URL]: oracles tutorials on how to read and write files, with example code.

Member Avatar for DavidKroukamp
0
168
Member Avatar for Melow

check the path of your file (if it has to be a .txt file => if !path.endswith(".txt")) false your values in your file : read them all into variables and check the values you get. but you'll need to be a bit more precise into how you want to validate …

Member Avatar for Melow
0
183
Member Avatar for azegurb
Member Avatar for dreamslct

[Code=Java] System.out.println(e2.count); [/Code] this line is a print, it prints the value of the count variable of your instance of echo. if you add a print statement in your while loop, you will see how many times it runs. if you copy the above print within the while loop, you …

Member Avatar for dreamslct
1
937
Member Avatar for anand01

the z: refers to the for loop, but you can't use it to refer to a single expression like o = o + 2; [URL="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html"]here[/URL] is a link you might find usefull to get to better understand the labels

Member Avatar for anand01
0
236
Member Avatar for enterpise

that depends on what arguments you pass. for instance, it won't work if you pass: -x100 since this will be the argument. also, you could optimize your test to check if the right number of arguments were entered: [Code=Java] switch(args.length){ case 4: // handle your arguments here, or set a …

Member Avatar for enterpise
0
209
Member Avatar for prachi munjal

looks to me like your code is trying to use these classes, but doesn't find them in it's classpath.

Member Avatar for stultuske
0
254
Member Avatar for Mr.BunyRabit

that are two different instances of the hspersonnelinvolvedclass-class, which means, for the instance in your second form, you never executed that setText method. if you want them to work with one instance, you'll have to pass a reference to that instance to the second form.

Member Avatar for stultuske
0
173
Member Avatar for syeda amna
Member Avatar for mKorbel
0
2K
Member Avatar for kyriacos1986

maybe not necessarily to solve your problem, but if you want to define your own threads, it's better to implement Runnable, than to extend thread. the only reason why you should extend is if you want to change something in the basic functionality of the object, which is most likely …

Member Avatar for forkmartin
0
138
Member Avatar for pygmalion
Member Avatar for WolfShield
1
516
Member Avatar for enterpise

what do you mean? you have your command line args, they are stored in your [B]args[/B] array [Code=Java] public static void main(String[] args){ } [/Code]

Member Avatar for enterpise
0
204
Member Avatar for ThaiAmL

roman.toUpperCase??? I assume you'll use your instance of Scanner (roman) as a means to read a String instance, which you'll then set to UpperCase and why this: return -1; break; return automatically ends the method by returning the value.

Member Avatar for ThaiAmL
0
1K
Member Avatar for VinC

well ... this has not very much to do with what JDK you are using, more as what type of object you use where and which you should use where. also, you could have created a new thread for this.

Member Avatar for DavidKroukamp
0
158
Member Avatar for connect2abhi

[QUOTE=connect2abhi;1738051]Hi I have a class A,B and C. Now B and C extends A. So is there any way that we can call a method of B in A? [/QUOTE] possible? off course. but ... a bit fishy. this would imply that A knows the type (whether) or not it …

Member Avatar for DavidKroukamp
0
13K
Member Avatar for Hajira Khanum

best thing is still to come up with something you are genuinely interested in: that way you won't loose motivation to work on it. also: you told us nothing about your course, what you've learned, what (if any) limitations you were given, .. a number of professors I've had used …

Member Avatar for stultuske
-1
184
Member Avatar for angerchiu

ehm ... an editor and a compiler? I think you'll need to be a bit more specific. depending on the kind of game, you should consider which first. do you mean: writing a game from scratch, or do you want to make a mod for an existing game? then you …

Member Avatar for stultuske
0
23
Member Avatar for sharathg.satya

[Code=Java] while(true) [/Code] the chance of this expression ever returning false is ... well, zero :)

Member Avatar for stultuske
0
187
Member Avatar for chandub

create a <div class="errorBox" (or id="errorBox" > </div> add a textcomponent in there with no text in it. as a default, you'll set the visible:false in the css for that div (class or id) and when you have an errormessage to show, you set the value to true, and set …

Member Avatar for chandub
0
87
Member Avatar for rahul.ch

when you call System.out.println(sb3); a bit hidden by the compiler, this will call the toString method of your Object: System.out.println(sb3.toString()); so, it's quite normal it gives the same result :)

Member Avatar for rahul.ch
0
237
Member Avatar for Razer13

you may want to be a bit more specific I assume using a textArea to write one, a Button to add it to your savedComments, and a small 'X' button in a subpanel that contains a comment linked to a deleteThisComment function would do the trick. that is, if you …

Member Avatar for Razer13
0
204
Member Avatar for ajacintha

didn 't you just recently create [URL="http://www.daniweb.com/software-development/java/threads/406861"]a thread[/URL] on this issue? why didn't you do what they suggested there? besides: [Quote] Please provide me solution for this im stuck with this. [/Quote] is a big NO-NO. first you'll have to provide any evidence you tried at least something yourself (and, …

Member Avatar for ajacintha
0
118
Member Avatar for Eragah

since in your other thread, I gave you this as a suggestion, what have you tried so far? and why did you start another thread? you could have asked issues about that in your other thread.

Member Avatar for peter_budo
0
113
Member Avatar for ayanbizz

why re-opening a dormant thread? if you have any questions about this, you could easily have started a new thread. also, it's against forum rules to just hand out custom code. have you or are you currently working on a similar project? if so, and you're having trouble with it, …

Member Avatar for Ezzaral
0
422
Member Avatar for Eragah

keep an array, or a list with types you've already added. when you create a new one, check in that array or list whether it already exists, if not, add it to the list, if it does, ignore it and create a new one. for future reference, when you say: …

Member Avatar for stultuske
0
240
Member Avatar for riahc3

what do you need two main methods for? I don't know what your vision about a "library" is, but AFAIK, a class library has no use for a main method.

Member Avatar for riahc3
0
529
Member Avatar for Eragah

I see no reason as why System.out.println("heat"); would terminate your screen. can you show your entire code? also, why are you using two dimensional arrays if you're only using the first element? a default array would be sufficient.

Member Avatar for stultuske
0
192
Member Avatar for jt_4285

try putting your main method into the Static_demo class, and remove the inner class where you've actually put it in.

Member Avatar for stultuske
0
247
Member Avatar for applejax77

here's your problem: [Code=Java] userString = userString.toLowerCase(); [/Code] you set your String so, that it consist solely out of lowercases, so ... no, it doesn't work, since the char you compare it to, is still upercase

Member Avatar for DavidKroukamp
0
148
Member Avatar for GoodLuckChuck

as Peter_Budo already mentioned: pdf's can be protected in a way that highlight and copy-paste is no longer a possibility. back to the OP: the possibilities depend on what pdf it is you are trying to copy.

Member Avatar for jumbowat
0
135
Member Avatar for wallet123
Member Avatar for divsok

by passing them as parameters, no doubt. do you know how to use the HttpServletRequest and HttpServletResponse? I think you'll be better of asking any servlet/jsp questions in the webdevelopment>>jsp forum

Member Avatar for divsok
0
170
Member Avatar for wallet123

why didn't you keep this in the other thread about this code? you have two major issues with this code 1. this [Code=Java] else if (ans == 0); { } [/Code] is placed within a [Code = Java] if ( ans == 1 ) [/Code] block, and will therefor never …

Member Avatar for hfx642
0
154
Member Avatar for Ashenvale

you can create a small method, where you convert your float into a String, with the separator (the ,) on the correct spot. then you return that String and place that in your printf command

Member Avatar for NormR1
0
100
Member Avatar for Ashenvale

the problem is you are overwriting the value you have for aveCost, instead of correctly calculating it and later on calculating the average.

Member Avatar for Ashenvale
0
123
Member Avatar for enterpise

but make sure you have an instance of the Scanner class on which you can run the methods of the Scanner class. to see how it works: look [URL="http://docs.oracle.com/javase/6/docs/api/java/util/Scanner.html"]here[/URL] you must also ask yourself: will you only use this value in this method, or do you need this value in …

Member Avatar for enterpise
0
146

The End.