salvin francis

Bartender
+ Follow
since Jan 12, 2009
salvin likes ...
Eclipse IDE Google Web Toolkit Java
Mumbai
Cows and Likes
Cows
Total received
102
In last 30 days
0
Total given
135
Likes
Total received
306
Received in last 30 days
3
Total given
161
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by salvin francis

Hi Teresa,
Welcome to Coderanch !

Is this a java question ? If yes, What's your chosen technology to show the form to the user (Swing/JavaFX, etc...)?

Can you also share the code done so far ?
3 days ago

Nathan Milota wrote:I took another practice test after doing readings and practice exercises and got only 49%.  I'm not sure why.  ...


As a response, I would like to re-iterate what paul mentioned above:

Paul Anilprem wrote:1. Stop taking mock exams.
2. Go back to the book ...

A bit more info about the program above...
One of Scanner's constructor does throw an IOException (this one), but the constructor you are using (see here) does not throw that exception:
Next, if you want to handle the out of range issue, you can look out for the ones thrown by in.nextInt(). According to Javadocs (see here)

Javadocs wrote:public int nextInt()
Scans the next token of the input as an int.
An invocation of this method of the form nextInt() behaves in exactly the same way as the invocation nextInt(radix), where radix is the default radix of this scanner.

Returns:
the int scanned from the input
Throws:

  • InputMismatchException - if the next token does not match the Integer regular expression, or is out of range
  • NoSuchElementException - if input is exhausted
  • IllegalStateException - if this scanner is closed
  • you can do this:Learn to read the javadocs for all constructors and methods that you are using and you would be good !
    3 days ago
    Isnt it simpler (and more secure) to send out an email with a link that works only one (or 3 times max or within a time frame)?

    e.g.

    Hi user,
    Please click on the link to modify data:
    http://somesite/somepage/modify-data/secretkey=123456



    4 days ago

    Junilu Lacar wrote:... I have. Scala, RabbitMQ, Kafka, Zookeeper, Akka, ElasticSearch, etc. all part of a greenfield system that was being developed in-house...


    Was referring to programming languages. AFAIK, Scala is the odd one out in the list above. I am working with Rabbit MQ as a messaging system it's good so far. But my discussion was about programming langauges. Java, Scala and C# are three different languages with different syntaxes.
    5 days ago

    Monica Shiralkar wrote:... My work requires me to know Java, C# and Scala.


    I would not imagine a job opening that requires all three at the same time. There are folks (me included) who have spent a decade being a java programmer, there are folks who have switched from one language to another over a course of time. But this is unique !!
    5 days ago

    Angus Ferguson wrote:which is the contract of the key of a hashmap (Hashcode, equals?)?


    I find this sentense very odd. First of all, if you are referring to the Map implementation, it should be "HashMap" (notice the capital H and capital M). Next, if you are referring to a method in the Object class its "hashCode" (since it's a method, only C is capital).

    Next, the contract that you are referring to, is probably the contract of equals vs hashcode, this has been discussed in our forums in the past.
    Here's a thread from our past that discusses this issue well : https://coderanch.com/t/678881/java/Equals-Hashcode
    6 days ago
    I think I understand what you mean. The easiest way I can explain it is by writing a simple code that does bubble sort.

    See the program below:
    Are you able to understand this code ?
    1 week ago

    Brad Wood wrote:...Looks like I have to use reflection for this task. The problem is that I'm fairly new to Java and don't have experience with dealing with reflection whatsoever.


    This raises another red flag to me.
    1 week ago

    Tim Holloway wrote:"If you were a tree..."


    I am Groot
    2 weeks ago
    I think this would be a shorter code with a Regex expression. You can use regex to extract the individual groups of numbers from the input and then do your code logic of checking against 666 and 9, etc...

    if you're not familiar with regex, you can read about it here : https://docs.oracle.com/javase/tutorial/essential/regex/
    Ideally, it would be possible to do the complete validation of the 666 and 9 too using regex, but I'd not suggest that.
    2 weeks ago
    Hypothetical questions are quite common now-a-days. I was once asked in a programming interview : "What if we want to move Mount Everest to a different location. What would be your strategy for this?" The discussion that followed involved stuff like the assumption that the mountain was a roughly the shape of a cone. Volume of a cone requires the radius and height. The number of trucks required to carry this payload, etc...

    It all depends on what a job's requirements are. If they want an innovative programmer, you can expect something in these lines. No question is too silly or lazy.
    2 weeks ago