Jenna Thomas

Ranch Hand
+ Follow
since Oct 03, 2005
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jenna Thomas

My first cow! Woohoo!

Seriously. Woohoo!
2 years ago
Thanks Paul Clapham!! For your quick reply, I didnt see your reply before I marked as resolved. But thanks a lot!
2 years ago
Similar threads has the answer to my question.

Its an operand precedence issue as mentioned here

https://coderanch.com/t/195015/certification/System-println

Im closing this thread off now
2 years ago
It blew my mind when I typed this:

String s1="Hello";
String s2="Hello";

System.out.println("s1==s2 "+ s1==s2);

And got false as the output.

I didnt know that String and bool operands combined with the + operator, returns a bool.

I suppose this has to do with rules regarding mixed data types. Could someone tell me what the exact rule is?

I needed to type the following
System.out.println("s1==s2 "+ new Boolean((s1==s2)).toString());

to get my desired output of
s1==s2 true

Also, is there any easier way. Thanks!
2 years ago
Thank you Jesper! I realize this is an almost 4 year old post- but it helped me resolve my issue. Id been trying to read a properties file from a jar using the following:

FileInputStream fin = new FileInputStream(path);
props = new Properties();
props.load(fin);

Id also been using FileInputStream(like Pavan) and it wasnt working for some reason (Ive still got to figure out why). Once I replaced the code with the following, it worked!

InputStream fin=null;
fin=ClassLoader.getSystemResourceAsStream(path); //this is a static function
props = new Properties();
props.load(fin);

A small note regarding the "path" variable mentioned above. "path" is the path to my properties file relative to where my main class is. So, if my main is com.test and the properties file is x.properties, I placed x.properties outside com when creating the jar and path was simply x.properties.
7 years ago
Im trying to go through the Sun Enterprise JAVA tutorial and trying to execute the examples in eclipse/jboss. This doesnt seem to be too tough a task, plus it gives a newbie like me a chance to learn eclipse better(thats what we work on primarily at work)
However, one aspect Im stuck on is trying to add a JNDI entry for a datasource. How is this done in eclipse? Is there a plugin to be used? Ive tried to use the plugin mentioned here:

http://renaud.waldura.com/software/java/com.waldura.eclipse.jndibrowser/.

But Im not too sure that its well supported (or even working with eclipse 3!)

So, could you please tell me what works for you!
Thanks for reading!
These seem like solid leads to look into. Thank you for replying!
8 years ago
Hello,

I am new to Enterprise java programming so, I thought of asking this group: Are there any good tools for reverse engineering?

Im trying to get the big picture (in terms of code flows) of a project that I just got in. THe project mostly involves maintenance now but I would like to understand the big picture of course.

What are the best tools to "reverse engineer" the code? My idea would be something like a tool (preferably open source) that can create sequence diagrams(even if the project involves MDBs) or atleast class diagrams.

I work in Eclipse so the ideal tool would be a plugin in eclipse. But Id like to hear from this group whats worked for them(a particular analysis process for eg?)

thank you!
8 years ago
Thats right.. it *should* be there.. even this page says so.. but I cant find such an folder anywhere.. Also, I tried setting the JAVA_HOME variable in a command prompt and trying to run the Jdk installer from this command prompt.. Still no deal.. Oh well.. I tried, I think I'll do a manual install.. Thanks anyway!
8 years ago
I know this topic is a bit old(only 2 years old!) but, Im facing the same problem on my recent installation of Jdk 1.6. I dont see the JAVA_HOME/db folder anywhere after installing it.. What magic step have I forgotten(I did install all the modules in the jdk)

Could you guys let me know if you've figured this out? thanks much!
8 years ago
Thanks Mike.. I should have phrased the sentence better- In a treeset, insertion happens according to sort order- natural ordering(Alphabetic) if its a String or custom ordering as defined in the comparator/comparable interface.
10 years ago
Thanks Steve, your explanation clears out the fog in my head about that. equals() (and its conjoined twin hashcode()) is used to determine equality -so they need to be implemented in hashsets where duplicates are not allowed. A treeset not only disallows duplicates, insertion has to happen in sort order. equals() does not provide enough information to determine the insertion point- only the comparator or comparable interface does that. Makes sense! Just writing it down made it clearer! Thanks again :-)
10 years ago
Ive just noticed that infact if it was a HashSet that I was adding the objects to, the equals() and hashCode() functions would have to be implemented else, meaningfully identical objects are added to hashSets EVEN IF the comparable interface is implemented!

So, I suppose its just best when creating a class equals(), hashCode() and the comparable interface should be implemented! Just in case, we decide to use either the treeset or the hashset? Anyway, why does the Treeset need the comparable interface to be implemented? Wont the equals() suffice?
10 years ago
Im trying to understand the concept here. I was reading about TreeSets in Kathy Sierras SCJP guide and Im confused. Heres the code sample-

import java.util.*;
class SetTest
{
public static void main(String[] args)
{
boolean [] ba=new boolean[5];
Set<DVDInfo> s=new TreeSet<DVDInfo>();
ba[0]=s.add(new DVDInfo("Donnie Darko", "Sci Fi", "Gyllenhal, Jake"));
ba[1]=s.add(new DVDInfo("Raiders of the Lost Ark", "Action", "Ford, Harrison"));
ba[2]=s.add(new DVDInfo("2001", "Sci Fi", "??"));
ba[3]=s.add(new DVDInfo("Caddy Shack", "comedy", "Murray, Bill"));
ba[4]=s.add(new DVDInfo("Caddy Shack", "comedy", "Murray, Bill"));

for (boolean b :ba )
{
System.out.println(b +" ");
}
System.out.println("\n");

for (DVDInfo o:s)
{
System.out.println(o +" ");
}
}
}

class DVDInfo implements Comparable<DVDInfo>
{
String name;
String genre;
String actor;

DVDInfo(String n, String g, String a){
name=n;
genre=g;
actor=a;
}

public String toString(){
return ("name="+ " "+name+" genre="+genre+" actor="+actor);
}

public int compareTo(DVDInfo d){
return name.compareTo(d.name);
}
}

Ive not overridden equals() or hashCode() here for the DVDInfo class. But the output is this-

true
true
true
true
false


name= 2001 genre=Sci Fi actor=??
name= Caddy Shack genre=comedy actor=Murray, Bill
name= Donnie Darko genre=Sci Fi actor=Gyllenhal, Jake
name= Raiders of the Lost Ark genre=Action actor=Ford, Harrison

Meaning that the meaningfully equivalent second object(ba[4]) I tried to add does not get added to the TreeSet. So, if the comparable() interface is implemented, does this mean that equals() and hashCode() does not have to be overriddden in an object that is going to be added to a TreeSet?
10 years ago