-
Replied To a Post in Frustrated with super simple code...
You have to `import java.util.Scanner;` to use the class name "Scanner" without fully-qualifying the name. The constant 9.0 is a double value (that's how the language is defined), so the … -
Replied To a Post in Frustrated with super simple code...
That code (with a Scanner declaration for kbinput, aqnd placed inside a method) compiles without any errors or warning in NetBeans, and gives the right answers when executed. Maybe the … -
Replied To a Post in How do I make a boolean true only when an item is found?
Initialise it to false, then set it to true in the code where you find or take an item? Or is the problem actaually more complicated than that? -
Replied To a Post in member id
No. What are you trying to do? -
Replied To a Post in Bluej
Search all the members until you find the right one, then return it? -
Replied To a Post in Reading a txt file
Your test data does not show you writing the ArrayList to the file. The exception is telling you that the data is the file looks like a single String. It … -
Gave Reputation to old_apache in Java 2d array problems
it is not printing, because you have condition here: if (row >= 0 && row <= 4 && col >=0 && col <= 4) System.out.print(list[col][row]=value); while you called table with … -
Replied To a Post in Java 2d array problems
albedini: please be polite. Old Apache is trying to help you. The very first sentence of his previous post explains why your print produces nothing with those call parameters. What … -
Replied To a Post in How can I run my project with out opening netbeans
That's right - the jar file (etc if needed) is placed in the dist folder when you build & clean, replacing anything that may have been there before (so don't … -
Replied To a Post in currentRoom variable will not update
There's only one thing on that line that could cause an NPE and that's currentRoom - you;ll get an NPE when you try to use that when its null to … -
Replied To a Post in currentRoom variable will not update
Well... First, you set newBoat to false on line 10 then try to see if it's false on line 11 - which ot always will be! Second, on line 11 … -
Replied To a Post in Returning a subclass object using superclass
Line 7 - looks like you are using next to create unique IDs? Problem is that next is an instance variable, every new instance will get its own next, equal … -
Replied To a Post in How can I run my project with out opening netbeans
Here's the tutorial: https://netbeans.org/kb/articles/javase-deploy.html -
Replied To a Post in help validating french phone numbers
You could play with something like this, which is just those simple rules: String regex = "(0|\\+33|0033)[1-9][0-9]{8}"; String data = "0512345678"; System.out.println(data + " is " + Pattern.matches(regex, data)); -
Replied To a Post in Automated custom cell renderer
That presumably works because you called the renderer yourself in order to initialise it (normally there's no reason to do that). If your renderer is for all the cells in … -
Replied To a Post in Automated custom cell renderer
I suppose you did remember to call setDefaultRenderer or setCellRenderer (for the relevant columns)? And did you setOpaque(true)? because the default renderer is a JLabel, which is opaque(false) by default, … -
Replied To a Post in help validating french phone numbers
Are you looking for a Java-specific solution or something more general, eg a regular expression. Are you just looking for the following rules: ( "0" OR "+33" OR "0033" ) … -
Replied To a Post in Lootable containers
*A. Develop a working application that implements an interface.* So far you have no interface in your code. If only to meet the requirements of the exercise you could make … -
Replied To a Post in Looking to add an icon (with a catch!)
Here's a screenshot from my NetBeans projects browser showing an images folder for one of my projects, placed alongide the java source code packages... Just add your resouces folder like … -
Replied To a Post in java desktop application installed on other PC
You package all your classes and any other resources into a *jar* file. See the web for tutorials, eg http://www.ntu.edu.sg/home/ehchua/programming/java/J9d_Jar.html http://docs.oracle.com/javase/tutorial/deployment/jar/index.html -
Replied To a Post in Audio Level Meter
It seems that getLevel was not implemented in the early releases (just returns -1 error code) It was listed as a bug around version 1.4.1, but as far as I … -
Replied To a Post in SuperClass instance points to SubClass Method After Casting
Java binds instance methods at run time, so when it executes `objecty.playMusic();` it looks at the actual object that refers to, and uses its methods as appropriate. The type of … -
Replied To a Post in Outputting text with Formatting
You're welcome! J -
Replied To a Post in Confused on how to utilize inheritance with this code
It looks like you are missing some essential steps in your understanding of how inheritance of methods and variables works... Heres a very good tutorial that will teach you everything … -
Replied To a Post in choosing http or socket
You have the info, now that's for you to decide. Nobody else can decide that for you. -
Replied To a Post in Recursion to make a Scholarly Neighborhood
Thoughts: Your outpout doesn't show any papers bu the co-authors, but maybe they come lower down in the list? There seems a (small) problem with duplicate entries being displayed? You … -
Replied To a Post in DefaultTableModel constructor failed if parameter is set to null when init
On a second reading, I'm less clear about this. The code as posted overwrites the initial value of AllSubjects before it is used, so the initialisation is irrelevant. Presumably this … -
Replied To a Post in Assistance with Parking Ticket Simulator
This is a model of a real-life situation, so think about what happens in real life. There are mulitple parked cars and meters. There is a policeman. The policeman looks … -
Replied To a Post in DefaultTableModel constructor failed if parameter is set to null when init
The API requires you to pass a Vector of Vectors. If you do that, it runs OK. If you pass a null it fails. Why is this surprising? Remember AllSubjects … -
Replied To a Post in Case problem integer or string?
Why is 27 teh correct result? What formula or algorithm are you trying to execute? For BigInteger see the API documentation, or Google for examples. -
Replied To a Post in Use user's input to set the decimal format
You can use out.printf to format multiple items in one line of code, but it's OK to have multiple lines. You should use whichever makes ypur program easier to read … -
Replied To a Post in Making the counter work
That's OK so far... except do you really want to stop taking input when the sum reaches 125? ps `System.out.print` is just like `System.out.println` except it doesn't go to a … -
Replied To a Post in CGPA
Here's a good nocive tutorial on Java 2D arrays: http://www.dummies.com/how-to/content/java-use-arrays-with-two-dimensions-or-more.html If you need more, the please be a lot more specific in your questions. -
Replied To a Post in Hospital Simulation
That is so vague that nobody knows how to respond. It's like "I'm having difficulty driving from Boston to Washington, please help". Please be very specific about what you have … -
Replied To a Post in Apache License 2
In my opinion (but I'm not a lawyer), if you're not modifying the original code then there's no problem. If you plan to distribute the original methods as part of … -
Replied To a Post in Use user's input to set the decimal format
"%.2f" controls the format, but it's just an ordinary string. You could (eg) prompt the user for the number of decimals and use that to construct the string with his … -
Replied To a Post in Doing math with strings
Try sitting down with papaer and pen. Do a test case or two by hand. Then you'll know exactly how it works. -
Replied To a Post in choosing http or socket
That's right. You can build a simple web server in Java SE quite easily - just a page or two of code, but if you want anything more sophisticated you … -
Replied To a Post in Java Word Count Not Working
There you go! The Text class has a variable called "text" that presumably holds the "humpty" or "dumpty" or whatever. That's what you can return from toString, so one of … -
Replied To a Post in Doing math with strings
Yes, that's the kind of thing. The programming style is a bit C-like, and the three almost-identical code blocks are in need of rationalisation, but overall the logic is exactly … -
Replied To a Post in Java Word Count Not Working
You haven't posted the Text class, but I'm guessing that has an instance variable with the word/text for each instance? It like my Person example - the Person class has … -
Replied To a Post in Java Word Count Not Working
OK. Every class has a toString() method. If you don't provide it then you inherit one from the Object class. The one you inherit gives you those strings like "Text@44ac8dff". … -
Replied To a Post in Java Word Count Not Working
I guess you didn't bother to read my previous post... Every Java class inherits a toString() method from the Object class, so methods like println use that to convert the … -
Replied To a Post in Java Word Count Not Working
Did you create your own toString() method in the Text class? -
Replied To a Post in Java Word Count Not Working
`Text@44ac8dff appears 1 times` - what's that Text@44ac8dff about? Every Java class inherits a toString() method from the Object class, so methods like println use that to convert the object … -
Replied To a Post in Bluej
Helpmeplease123: This is not a "we do your homework" service. *Try* to solve your problems yourself before asking for help. For example, 30 seconds with Google will give you all … -
Replied To a Post in how to store JTree data hierarchically in mysql database from netbeans
mKorbel - that code makes complete sense to me. You want to display something other than the default toString() in the cells, and you want to set a custom tooltip … -
Replied To a Post in Doing math with strings
stultuske: its totally obvious that this is a task that he has been set. Yes, it makes no real sense, but as a programming exercise he has no choice but … -
Replied To a Post in how to store JTree data hierarchically in mysql database from netbeans
Thanks for the clarificatio mKorbel. There's no doubt that is the way to go for complete control or for difficult cases, but personally I would be happy to live with … -
Replied To a Post in how to store JTree data hierarchically in mysql database from netbeans
"toString isn't about good practicies(Java=>6)" Do you have any info about that? J
The End.