James Basller

Ranch Hand
+ Follow
since Sep 07, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by James Basller

santhosh.R gowda wrote:Dear James

Please can you explain your answer more clearly...



When we create any string literal with respect to memory efficiency JVM creates its own String Constant Pool. Now, this pool contains the literals and if the same string found by the JVM it will check whether the string is already there in the pool if there then it will not create any new string and take reference of the same string which is already present in the pool.

So, to make sure that strings already there in the String Constant Pool remains unchanged with blocking overriding operations String class is marked as final.

Thanks
James
13 years ago

santhosh.R gowda wrote:Dear All

As we know if we make class final the class cant be extend by another class

so my question is if we make class final what is the use of making methods final even though we cant override that method because we cant extending the class
so why in java API String methods are final



Hi

Because Strings are immutable means when we create any string it will occupy new space in the memory.

Thanks
James
13 years ago

Cj Turner wrote:Thanks for the speedy reply, I since posting this have worked out my initial problem, and have moved onto others... This is my code as it stands,




Now the issue with this is, where I have

The second if statement returns the current value, while the first always returns 0,

I'm sure the tempNum is assigned a value before it reaches the if, so it should have something greater than 0 to store there?




hi,

I think the only issue is with if block.

Try below code instead of your if blocks:



Hope you will get proper answer.

Thanks
James
14 years ago

Vishnu Sharma wrote:I have a doubt in it. It was given that if we do not use any super statement for calling a constructor of superclass in subclass, a superclass constructor with no arguments is called implicitly. But a compile time error occurs, if superclass does not has a constructor defined with no arguments.
My doubt here is when a default constructor is there for each class, and this default constructor has no arguments, then why this compile time error occurs??
Do we need to explicitly define the default constructor also in super class??



Yes. That's true. We don't have to define constructor explicitly.



My above code is not giving any kind of compliation error. So, can you post your code so it will be better to guide you???

Thanks
James
14 years ago

Michael Dunn wrote:the problem is here

newEvent = new NewEventForm(cg);
newEvent.requestFocus();
newEvent.setVisible(true);

NewEventForm is a modal dialog, so the requestFocus and setVisible lines are not executed until the dialog closes,
then, when closed, setVisible(true) is executed.

remove those requestFocus and setVisible lines and it should work OK.


[edit]
forgot to add that NewEventForm contains a setVisible(true) in it's constructor



great!!!

it works for me a lot!!!

Thank you so much!!! :)

Thanks
James
14 years ago

Chinna Eranna wrote:sorry.. typo..

getNextElement() ---> nextElement()




yes...

I have solved my mistake.

As getCurrentCategories() method is deprecated I have used above code but it gives me object of org.apache.log4j.Logger not the category class objects

so basically why I need this to get Enumeration of multiple categories and get priority of each and every category...

Can you please give me answer?

Thanks
James

Chinna Eranna wrote:you can use getAllAppenders() to read information related to Appenders.

And getCurrentCategories( ) of Category class to get the categories defined.

Note that getCurrentCategories( ) is deprecated..

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Category.html#getCurrentCategories%28%29




Hi

Thanks for reply!!!

Here what I am doing is like



This is what I am doing to get categories from $JBOSS_HOME/server/default/conf/log4j.xml file.

As getCurrentCategories() method is deprecated I have used above code but it gives me object of org.apache.log4j.Logger not the category class objects

So, can anyone please do more focus into this?

Thanks
James
Hi All,

I need to get all the properties from log4j.xml

So, can anyone please help me out to solve this?

Thanks in advance!!!

Thanks
James
As I have seen your code there is no main method in SimpleDotCom class which is there in SimpleDotComTest.java. So, to run SimpleDotCom program you should have main method within that class then and then only JVM will come to know where should it has to start program execution.

Now, regarding game class I think that you are running downloaded or ready made code. Here, if your files are in Bin folder of JDK. But there is no package structure defined for your class that's why this error comes that package "helper" does not exist. You should put your classes in helper directory.

Thanks
James

raj david wrote:Hi,

Apologies I will get familar with the tools available, I don't know how to do this yet.

I am coding in the following way....

C:\Sun\SDK\JDK\bin>javac SimpleDotComTestDrive.java
above complies but when I do the following
C:\Sun\SDK\JDK\bin> java SimpleDotCom
output shows as...
hit
failed


C:\Sun\SDK\JDK\bin>java SimpleDotCom
above complies but when I do the following
C:\Sun\SDK\JDK\bin> java SimpleDotCom
then this message is showing...
exception in thread "main" java.lang.NoSuchMethodError: main

But if I do Game one, which is
C:\Sun\SDK\JDK\bin>javac Game.java
then I get this error...
Game.java:1: package helpers does not exist
import helpers.GameHelper;
^

Thanks

14 years ago
Hi

Can you please post how you are running your Java program?

Thanks
James
14 years ago

Rob Prime wrote:What is this LSB_LO format? Do you have the specification for that?

And what's this "getBytes()" method? I hope you're not talking about String's getBytes() method? Because you cannot use Strings for binary files. To convert a binary file to a byte array use ByteArrayOutputStream; copy all data from the FileInputStream to the ByteArrayOutputStream, then call the latter's toByteArray() method to get the byte array.



Hi Rob

Thanks for reply!!!

Actually LSB_LO format; i.e. the least significant byte of the binary number. So, whole file is written in this format. And yes I haven't used getBytes() of String I am just telling that I have a method which reads whole file and returns byte array of that.

And then I took one by one byte from that and converted in to HEX format. But I don't know what will be the next step I need to follow.

Thanks
James
14 years ago
Hi All,

Actually I have a binary file in which Binary fields are stored in LSB_LO format. So, can anyone please tell me how can I read this file and how can I convert this file in to normal string presentation?

I have tried to read file with FileInputStream. Then I getBytes() from that file and after getting bytearray I converted one by one byte in Hex format.

But I don't know how to parse?

Thanks
James
14 years ago
Hi All,

I am very new to Oracle TimesTen. I am using Windows XP operating system. I have installed Oracle TimesTen 7.0. All paths and environment variables are set with installation. Now, I am stuck with how to create DSN.

I have Oracle Client installed on my machine and my oracle database is on linux system. I have installed TimesTen on my machine where oracle client resided. So, now I have one schema named "XYZ".

How can I make DSN that can connect with this schema with TimesTen?

Thanks!!!
James
14 years ago

Marcus Polk wrote:What is this. I'm reading Head First: Java.

It says that I'll need some type of j2se api documents. I need to download it and what not, but when I go to the java website, it just gives me a huge lump of text with some links...it's confusing. Why do I need this?

Also, how do I find out where it installed my SDK?

I usually have problems like this in the beginning thanks for the help!

~Marcus



Hi Marcus,

Actually API in Java is a document which gives you details of all Java classes that SDK includes in it. Without downloading that you can also view API document online when you search for any classes but it's good to have API document

You can find API doc online at http://java.sun.com/j2se/1.5.0/docs/api/

Thanks,
James
14 years ago

Sgc Manorite wrote:

Originally posted by Jan Cumps:
As a last thing, can you please try to replace

with
Regards, Jan



Thanks for the help. I am not able to reproduce this issue on my local environment. Will have to monitor for this exception on production server after which I will update this post with my comments.




Hi,

I also facing the same problem and also I am not able to regenerate this scenario. So, can you please tell me after doing change from setObject() to setInt() have you faced this problem anymore till date?

Thanks!!!