-
Replied To a Post in Explaining public/private/protected concepts to clients/users/bosses
> to protect you from yourself so you can't screw anything up. Just don't touch it. You don't need to touch it or know about it or care about it. … -
Replied To a Post in Compiling and executing Java code while executing a Java program
> It seems like the script needs to be written as Javascript, not Java code, yet it's somehow running on a Java Virtual Machine? Yes, that's right. Nashorn compiles the … -
Replied To a Post in Compiling and executing Java code while executing a Java program
OK, here's another gift ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("nashorn"); // create a list List<java.awt.Point> list = new ArrayList<>(); // expose list as a global variable to … -
Replied To a Post in Compiling and executing Java code while executing a Java program
It's true that the syntax etc of JavaScript is only slighly like that of Java - but unless your users are Java coders that's irrelevant. If they need to learn … -
Replied To a Post in Compiling and executing Java code while executing a Java program
Have a look at the JavaScript support in Java - it allows you to run javascript (and other scripting languages) dynamically from your Java program while sharing varaiables and objects … -
Replied To a Post in Java Scanner -- Scanner going beyond token
Sorry, it's a dull Sunday morning and I couldn't resist working on my Regex skills a bit. Here's what I came up with... String data = "( 4.5 , 8.9 … -
Replied To a Post in Java Scanner -- Scanner going beyond token
That all makes sense. One advantage of the DIY solution is that you get to chose how to deal with malformed input rather than being stuck with whatever uninformative thing … -
Replied To a Post in Java Scanner -- Scanner going beyond token
OK. From what you had said ("I cannot assume that there will be white space") I assumed that the white space was not a delimiter, only the parens and the … -
Replied To a Post in Java Scanner -- Scanner going beyond token
I'm not good at regex, so I often start by removing all the white space (one simple method call) so what remains is easier to parse. -
Replied To a Post in Why downloading speed is higher than upload speed ?
If you are using an ADSL connection then the "A" stands fo "asymmetric" - most of the bandwidth (usually 80%) is dedicated to download with typically 20% for upload. See … -
Replied To a Post in interfaces and classes exercise
Yes, that's enough for you to be able to move on to storing Collections of people. Before coding anything, think about where you might find a collection of people in … -
Replied To a Post in interfaces and classes exercise
There's not enough code there to be sure, but at a guess in Person's constructor you are failing to save the address parameter correctly into the instance variable (or maybe … -
Replied To a Post in interfaces and classes exercise
As for where to create an address.., There is a debate to be had here, but my opinion is to prefer Address addr = new Address (blah blah blah); Employee … -
Replied To a Post in interfaces and classes exercise
Sir Charles Antony Richard Hoare, inventor of `null` once said > I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, … -
Replied To a Post in interfaces and classes exercise
If every Person has an address then Person is the right place for it. The toString should delegate formatting an Address to the Address class as in my reply. A … -
Gave Reputation to FC Jamison in Median
I won't write your code, because like others have said, iy is not our place to do your homework for you. I will, however, give you some psedocode to point … -
Replied To a Post in interfaces and classes exercise
Address, like pretty much every other class, needs a toString. That's a public method, so you can call it from anywhere. Going back to the car... class car { ... … -
Replied To a Post in interfaces and classes exercise
You create an Address class in the same package, alongside the other classes. You can then use that in any or all of the other classes. Because most people do … -
Replied To a Post in interfaces and classes exercise
You may have noticed that I has second thoughts and changed that suggestion to Address instead - it's easier to see what the attributes are. Projects are more independent, and … -
Replied To a Post in PHP OOP SELECT Query
Maybe a small point, but naming is ever so important in OO implementations... Would that class not be better called "Connection"? -
Replied To a Post in interfaces and classes exercise
I get where you are coming from, but that extra info just looks like ordinary attributes of an employee to me, and not a good reason for another class. How … -
Replied To a Post in Median
> id like to know the java program of this one We do not do people's homework for them. Try to write it yourself. If you get stuck post what … -
Replied To a Post in GUI layout
Trying to use dubious tools when you don't understand the underlying code is a really bad idea. At best you'll get some result that you won't understand, at worst you'll … -
Replied To a Post in advice/ suggetion for career guidelines
A course will teach you a specific technology. The knowledge you gain will be out of date soon afetr you finish the course. Whatever is "booming" today will be "boring" … -
Replied To a Post in Building a java converter
Think about it like this: Is displaying a message part of the behaviour of a unit definition in real life? Uuit definitions have names, and factors or formulae that relate … -
Replied To a Post in need some help with netbean java programming
just for the record... you can also switch on String values and enums. In this case a String would seem more natural for a transaction code, even if it is … -
Replied To a Post in interfaces and classes exercise
I think salary belongs in Employee - only employees have a salary. This is typical of how a subclass can *extend* a superclass to add more info that's just relevant … -
Replied To a Post in Button when pressed saved into array
You are creating anonymous inner classes that subclass RndListener - they override the actionPerformed method so the RndListener become redundant. Either piut your code in RndListener in some general form … -
Replied To a Post in Button when pressed saved into array
Have a counter that you increment each time the button's actionlistener is called. Test it each time. When it reaches the limit print the array and stop. -
Replied To a Post in interfaces and classes exercise
If a class needs some variables initialised then an empty constructor is just asking for trouble. Obviously if you don't have one then you can't call `new` with no parameters, … -
Replied To a Post in Building a java converter
In my opinion you need another class to hold all the UnitDefs for some measure (length, weight etc) and provide a simple interface for the GUI to use. But maybe … -
Replied To a Post in interfaces and classes exercise
OK, it's a start. Be careful with your terminology. If Person is a class then the others have to `extend` it. If it's an interface the others `implement` it. Chosing … -
Replied To a Post in Building a java converter
No, that's just test code so anything goes. I was referring to public class UnitDef extends CustomComponent{ public String name; public double multiplier; -
Replied To a Post in Building a java converter
So far so good! Since this is for fun, I would say quickly implement and test another conversion (ie a set of UnitDefs) such as weights to be sure that … -
Replied To a Post in error in parsing text files Java
This is very similar to OP's other post, and contains the same potential null pointer, and uses `finally` in same bad way. -
Replied To a Post in Streamtokenaser
Compiling with all the diagnostics on (which you should always do) just shows that `printOut` on line 129 etc may be uninitialised. That's right - if lines 52 thru 55 … -
Replied To a Post in Streamtokenaser
"I assume i do something wrong" tells us nothing. If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If … -
Replied To a Post in Tell me what I am missing here
I'm sorry, but what you have done there is nothing like what I suggested. And I already explained why you have no output. Please re-read my previous post carefully. -
Marked Solved Status for Java JOptionPane not showing an answer
Hi all can you throw some light on the resolution of my problem,should be simple ,but can not figured out .Here is my server and client class,The problem is server … -
Replied To a Post in Java JOptionPane not showing an answer
Client line 19 you use `write`, which just writes the low byte of its int parameter, but in the client you `readInt`, which neeeds 4 bytes, so the `readInt` is … -
Replied To a Post in Tell me what I am missing here
You have a load of get methods that change the values of your variables, eg public double gethoursWork() { hoursWork = hoursWork * rateOfpay ; return hoursWork; } now suppose … -
Replied To a Post in Can't Quite figure this one out ORA-00907: missing right parenthesis
Seems bizarre that an extra R.P. is diagnosed as "missing" :) -
Replied To a Post in greeting from new guy
Hey yes, welcome. Get started by helping to answer other people' questions, or asking sensible questions of your own. The more you put in, the more you get out. -
Replied To a Post in Clicking a button on one window closes a different window
No, the instance of the class. So if win2 needs to dispose win1 as well you can do something like JFrame win1 = new Window1(); ... JFrame win2 = new … -
Replied To a Post in Java interview exercise. Question regarding, 'packaging and communication'.
> basic tenants of software object based design, and a little about how developers communicate and work together A key idea here is that objects have a public interface and … -
Replied To a Post in Building a java converter
I think it's more natural to define the unit like you did ( 1kM = 1000M), so it's better to swap the multiplies and divides in your two convert methods … -
Replied To a Post in Code Efficiency
If you are measuring network packets then the OS code involved in receiving those packets will be orders of magnitude more than anything you are adding. Just make sure your … -
Replied To a Post in Generating Bills
Sounds like cron job to me. I'm out. -
Replied To a Post in Generating Bills
I obviousy don't undertand what this app is supposed to do. Every customer has the same 2 dates and charges? My utility bills depend on the amount I use (the … -
Replied To a Post in Clicking a button on one window closes a different window
You will need the window with the back button to have a reference to the other window that needs to be closed. Then you can call that window's dispose method... …
The End.