|
I wish I had £1 for every time I suggested the OP spend some time studying this subject.
I must get a clever new signature for 2011.
|
|
|
|
|
pancakeleh wrote: Right now i dont face any error but however i dont see the value that i have added, being added to the table.
You would of course need to write code that does in fact do an update to the table.
|
|
|
|
|
I have written a method in sessionBean named updateIncident for adding the values to the database.
the codes as follows:
public void updateIncident(Integer incidentIDName, String incidentNameName){
incidentdataDataProvider.refresh();
RowKey rkUpdate = incidentedataDataProvider.appendRow();
incidentdataDataProvider.setCursorRow(rkUpdate);
incidentdataDataProvider.setValue("INCIDENTDATA.INCIDENTID", incidentIDName);
incidentdataDataProvider.setValue ("INCIDENTDATA.INCIDENTNAME", incidentNameName);
incidentdataDataProvider.refresh();
}
|
|
|
|
|
thanks but where should u put all this code(mean to put it inside the try and catch or where...)
|
|
|
|
|
Please tell me some details about static class/methode , i search for it on internet in forms etc but i didn't yet setisfied and still unable to explain it in confident and clear way
the most common questions about static class/methode in my mind are,
- why use static class
My Knowledge >>
They provide access to class static methode directly without creating its instance.
they have same instance in memory .. means every use/access to this methode can have changes effect for every one.
ANY OTHER BENEFIT AND PURPOSE !!
Also please tell me clearly the basic purpose of static class/method ... in interviews they always as to me about it and i always failed to answer clearly to him
|
|
|
|
|
Static can be used in various ways.
Anything that needs to be shared across all instances of a class can either be made static - easy - or passed around in another object - hard.
Certain design patterns - I'm thinking the singleton here - rely on static methods to encapsulate class functionality and control behaviour.
Any method that does not (or must not) use instance data should be static to prevent it accessing the instance data.
There is no need to instantiate an object to call a static method - say a helper class providing oft called methods - have a look at the static methods on String .
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
|
|
|
|
|
Thanks for your help .... Thanks a lot
|
|
|
|
|
Have a look at the Java Tutorials[^], they contain an excellent introduction to all aspects of the language.
I must get a clever new signature for 2011.
|
|
|
|
|
Static methods are frequently used in several design patterns (Singleton, DataFactory...) but, to give you something very simple and easy to understand, think about Math class. How do yo use it?
a = Math.abs(n);
a = Math.floor(n);
a = Math.sqrt(n);
...
So, as you can see, we don't have to create an instance of Math class, becouse we just use its static methods. In these cases, we say the Math class only offers services, and that is why all of its methods are static.
|
|
|
|
|
Thanks for your help .... Thanks a lot
|
|
|
|
|
static can be declared for variables and methods. When instance variables declared as static then its called class variables. Local variable can not be static.Each and every object share the same variables. In the sense when one object modify the variable the result will be reflected in all objects. With out creating object static variable methods can be accessed.Before object creation static variables initialized or instantiated.
|
|
|
|
|
How i campare two objects, such that if i have class(given below) and i want to compare there two different instances then how ??
class MyNode {
MyNode left;
MyNode right;
}
Is there any possiblity to do that --->
public boolean MyFunction(MyNode toSearch, MyNode parentNode) {
MyNode currentNode = parentNode;
while(currentNode != toSearch) {
return true;
}
else {
currentNode = currentNode.left;
}
}
return false;
|
|
|
|
|
You should implement your own Equals() method in your class and use that to test for equality. Using the == and != operators will not give the result that you are looking for.
I must get a clever new signature for 2011.
|
|
|
|
|
but can you please give some guide line to do this ... such that one way in my mind is like this that i put an Interger property in class that are then use to identify different instanceof class .. such that 1 for 1st instance/node then 2 for 2nd and so on and then compare some thing like this NodeA.IntegerIdentifier == NodeB.IntegerIdentifier but i doesn't satisfy with this idea as it is not apply in real senario as because in programming we should try to make solution in some thing like general awy.
So is there any idea aur suggestion for me that how i achieve this equality problem/isue what ever
|
|
|
|
|
See here[^] for lots of information on object equality.
I must get a clever new signature for 2011.
|
|
|
|
|
I think the OP wanted to search for a specific class instance in a linked list (at least, that's what I guessed from his code snippet). Thus, his code using the == operator was fine.
|
|
|
|
|
you are right Cédric, I did not spend enough time reading the question.
I must get a clever new signature for 2011.
|
|
|
|
|
Thanks A LLLot .... Thanks for your great help ....
|
|
|
|
|
khurram_shahzad wrote: and i want to compare there two different instances then how ??
Your question is not really clear.
There's a difference between having the same instance and having two different instances which are the same. In the first case, you want to verify if you are talking about the same instance. That's what you do in the code sample you posted: you check wether currentNode is the same object as toSearch .
In the second case, you want to verify that two instances contain the same thing but they are most of the time two different objects.
In your case, from what I saw in your code sample, you want to verify whether you are talking about the same object. Thus, it is fine to write it the way you did and it will work fine (in fact, when you use the == operator with objects, it will compare if the adresses of the two objects are the same, thus return true if the two pointers point to the same class instance).
|
|
|
|
|
Yes here im comparing to diffrent instace of same class .....
Thanks A LLLot .... Thanks for your great help ....
|
|
|
|
|
Hi,
m a beginner for java, n i wanna know which simulator/editor is good for doin java programming plz.
|
|
|
|
|
I do my Java programming with netbeans and Eclipse and till now these two editors are best editors for me.
[Specially Eclipse]
|
|
|
|
|
Eclipse[^] is a very easy to use IDE for creating and testing Java programs, assuming you are reasonably familiar with the language. If you want a "drag & drop" program builder, then NetBeans[^] may be a better choice. In either case you should spend some time going through the Java Tutorials[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Eclipse. There is a wide spread support on this one.
Try to write as much as you can yourself - click&drop are not really helpful as you do not see the code behind the action.
I also recommend buying an old fashion book, it's much easier to read something in a book while programming than to switch the screen multiple times.
regards,
Torsten
I never finish anyth...
|
|
|
|
|
TorstenH. wrote: than to switch the screen multiple times.
Or get a second monitor.
I must get a clever new signature for 2011.
|
|
|
|