Java basic question

I have an id that is a Long. I want to increment it using a random number. However, I keep getting errors that Im lookong for a java.lang.Long but have a long.

How can I convert the random number long to a Long?

or how can I increment a java.lang.Long using an integer?

Hi Rustic,

Create the random number as an Integer (not int) then you can call .longValue() which will return a long datatype.

Hope this helps.


Hi Arun,

I don’t really understand your question. Can you please elaborate further?

The Java 1.4.2 API is available at

If you need further information about the classes etc.



You’ll find that you can have multiple inheritance by using interfaces.

This is a good article java does not have a multiple inheritance (via two or more extends).


how the System.out.pritnln() is defined

why there is no multiple inheritance in java?

It introduces ambiguities and makes the code difficult, and sometimes impossbile to read. But mainly it has proven to be unnecessary.

who when and why java was invented?

Hi manjunath,
The above website should be able to help with your questions.


Hi Prasad,

I had a look at that zip file - more specifcally, the file “java-technical-questionnaire.doc”.

There are just over 300 questions to be answered. Some of them arn’t even Java related, over half of them can be answered by using google.

I am sorry, but I do not have the time to answer all these questions.


please answer to this questions as soon as possible


I was wondering how to send a quesry to a search engine via Java and capture the respond? I need to do this task several times a day. Can you please tell me what to use. This stuff is new for me.


hi friend

inorder to achieve multiple inheritance only we are using the interfaces.

using interface we can acieve multiple inheritance indirectly by using the extends and implements keword.

Hello I need java Quiz ,java questions an objective type ,please sen tas soon as possible

You can convert your long variable into a Long object by instantiating an object of Long.

long id = 9;

Long obj = new Long(id);

what is an interface and why it is?

its simple man,

first u convert the “long to string” by String var=""+.
then using the parseLong() of Long class , u can obtain ur desired result.


Write a Java application, StringAnalysis1, that reads a string consisting of 0’s and 1’s only, validates its input,
and then reports on the length of the longest sequence of 1’s in the string read and the index of its starting character.

i want all of the questions .please forward thease as well as others on my mail

In awe of that asnewr! Really cool!