Hello,
I want to retrieve the name of an attribute in a string
Example:
How can this be done in java, I am new to this programming language, so please I need your help. Thanks in advance.Code:int size = 3; String str = "Size";
Hello,
I want to retrieve the name of an attribute in a string
Example:
How can this be done in java, I am new to this programming language, so please I need your help. Thanks in advance.Code:int size = 3; String str = "Size";
Hello,
I think you can make a code similar to this
Here is the general form of the code
More than how you'll find your Field, I mean to say why do you want such an output or result that will be unnecessary for a program.Code:Field e = ... ... e.getClass().getCanonicalName();
Hello,
Even I was trying a similar kind of a program, I used you solution and thanks I found what I wanted. If you do not mind one more question.
I want to retrieve the name of the instance of a class (the object name what).
Any help on this will be highly appreciated.Code:public class mcls ( ... display the instance name ... } public static void main (String [] args) ( inst mcls = new mcls (); }
Hello,
If it's just to test and see who called your Standings, you can do:
I think it would be better to use the stack trace in your code. Otherwise I am not sure how to do. If you need any more information on this then please visit the Sun's official site and there you can find methods or function or classes for all the java programming language.Code:Exception ex = new Exception(); ex.printStackTrace();
Hello,
Basically recover "inst" has no meaning in the sense there in the code. The variable name is the name of the instance pointer, so the body can not know the variables that reference. And if you approach it in your body that you do for a variable. Is that clear enough? If you are not understanding this then I am sorry you have to read some basics of java first and then try to implement the code or try coding.
Hello,
I am new to java and I do not exactly know what you need, but I have a sample code with me, see if this helps you.
Here is the code
Code:String str="some text"; String vldch="some "; str=str.toLowerCase(); // case desense! for (int i=0;i<str.length();i++) { char c=str.charAt(i); if (vldch.indexOf(c)==-1) {System.out.printf(" character["+c+"] at position "+i);} }
Bookmarks