Refering a variable  value  whose name is stored in a string

if the pgm is like this
String abc= " marks";
int marks = 65;
using abc i want to refer the value of marks
can any one help me ?

Wow that sagely advise doesn't seem to be good at present:
Google  Error  
We're sorry...
... but we can't process your request right now. A computer virus or spyware application is sending us automated requests, and it appears that your computer or network has been infected.
We'll restore your access as quickly as possible, so try again soon. In the meantime, you might want to run a virus checker or spyware remover to make sure that your computer is free of viruses and other spurious software.
We apologize for the inconvenience, and hope we'll see you again on Google. :)

Similar Messages

  • Can I Execute a function whose name is stored in a string variable?

    Can I execute a function whose name is stored in a string variable?
    Like
    Depending on the condition I will stroed the name of the function in a string variable. Then using that string variable i want to execute the function.
    String str=��
    iVal an int can take ne value
    Switch(iVal)
    Case 1:
    str=�test1()�;
    Case 2:
    str=�test2()�;
    I want whatever function name is in str to be executed.
    ----------------------------------------------------------------------------------

    For just executing a method or two, reflection might be easier than beanshell (or it might not). For executing entire scripts, beanshell will be preferable over reflection.
    (I assume beanshell uses reflection under the hood, but I've never bothered to peek.)

  • How do you make an object, whose name is equal to a String?

    Ok, heres my situation, I have a vector full of strings which i've enumerated.. and i need to create a bunch of JCheckBox's whose names are equal to the strings in the Enumeration..
    I tried going:
              Enumeration Type = TypeList.elements();
              while(Type.hasMoreElements()){
                   String T = (String)Type.nextElement();
                   list.add(new JCheckBox(""+T));
    which makes them appear in the GUI, but i dont know how i would then be able to add an actionListener onto that checkbox, or indeed how i would go about accessing any of them when they dont have actual names.
    ANy Help would be appreciated.
    Thanks

    Yeh.. i dont get this.. I've got them to appear in the JPanel with:
              Enumeration Type = TypeList.elements();
         boxMap = new HashMap();
              while (Type.hasMoreElements()) {
                   String T = (String) Type.nextElement();
                   JCheckBox b = new JCheckBox(T);
                   boxMap.put(T,b);
                   list.add(b);
                   b.addActionListener(ch);
    Thats all well and good, but when i try and see which one has been clicked using a similar fashion:
                   if(ae.getSource() instanceof JCheckBox) {          //checkbox
                   Enumeration sourceCheck = TypeList.elements();
                   System.out.println((JCheckBox)ae.getSource().getAccessibleContext());
              Map SourceMap = new HashMap();
                   JCheckBox compare = (JCheckBox) ae.getSource();
              while (sourceCheck.hasMoreElements()) {
                   String T = (String) sourceCheck.nextElement();
                   System.out.println(T);
                   JCheckBox b = new JCheckBox(T);
                   SourceMap.put(T,b);
                   if(compare == b)
                        System.out.println("Oh My : "+T);
                   System.out.println("ZoomJ I have been clicked");
    in my action performed method it doesnt seem to be able to compare them.. its definately registering that its been clicked because it prints out the 'ive been clicked ' message, and it prints out all the correct names from the Vector, but it doesn't seem to compare them..

  • APEX - accepting OUT variable values from PL/SQL Stored Procedure

    I have created a page (Form) which is accepting values text fields.
    In the Page Processing section under Processing, I am passing the values to a PL/SQL Stored Procedure, which acts like an API. The procedure contains code to validate the entered data and finally insert the data into the base tables. The procedure also contains OUT variables in the parameter that would return status of processing and any error messages.
    Now, my question is, how can I make the page accept these OUT variables from the procedure. What I wish to do is, to capture these messages/processing status from the procedure in the page. For example, if there is a error in the data and the procedure is sending this message in the OUT variable, I need this to be displayed on the page as an error message.
    Is this possible in APEX?
    Regards,
    Santhosh Jose

    Hi VC,
    I just tried putting the string directly instead of the variable. Its still not giving me the expected results.
    HOWEVER, I think the reason was because of the EXCEPTION block in my code. I have an EXCEPTION block to handle exceptions. I commented the WHEN OTHERS section and now the error message is coming on the page.
    So what I have done now is as follows: At the point at which the error is expected, I am raising a handled exception. And within the exception handling, I am giving RAISE_APPLICATION_ERROR.
    WHEN ex_main_error*
    THEN*
    p_status := 2;*
    p_msg := 'ERROR Stage: '||lc_err_stage||' ERROR Message: '||lc_err_msg;*
    RAISE_APPLICATION_ERROR (-20001, p_msg);*
    This is working now! Which is very good news. Thanks once again for your help!
    Regards,
    Santhosh Jose

  • Creating a variable whose name is the value of a String

    Hi guys
    i want to create java variables dynamically whose name is the
    value of String .
    Such as
    String str="object";
    now i want to ceate a variable of
    type int whose name will be "object".
    in what manner i can do this.

    i want to create java variables dynamically whose
    name is the
    value of String .
    Such as
    String str="object";
    now i want to ceate a variable of
    type int whose name will be "object".
    in what manner i can do this.
    You can't. The best you can do is create a Java source file and compile it on the fly.
    Could you tell us why you want to do this? I have no doubt at all that you are working with a bad design, and maybe we could help you fix it.

  • Use Variable value name???

    Is there a way to use a variable value's name to load data?
    What mean is, if I have a variable called "var1" and I load
    "var1" from an XML file so the value of "var1" == "XYZ", is there a
    way to use the value "XYZ" to load data to a Dynamic textbox call
    "XYZ"?
    var1 = "XYZ"
    ( XYZ is a dynamic textbox on the stage and I need to load
    XYZ with incoming data )
    Example: XYZ = "What ever text I have"
    ( but XYZ is really the vaue of "var1")
    Thanks - Gary

    yes, you can resolve strings into objects by using array
    notation. for example, if XYZ is the instance name of a textfield
    on the _root timeline and var1="XYZ", you can use:

  • Convert String variable value  to an Object referece type

    Hi all,
    I want to know that if there any possible way to convert String variable value to a Object reference type in java. I'll explain by example if this is not clear.
    Let's think that there is a string variable name like,
    String name="HelloWorld";
    and there is a class name same to the variable value.
    class HelloWorld
    I am passing this string variable value to a method which is going to make a object of helloworld;
    new convertobj().convert("HelloWorld");
    class convertobj{
    public void convert(String name){
    // in hert it is going to create the object of HelloWorld;
    // HelloWorld hello=new HelloWorld(); just like this.
    now i want to do this from the name variable value.( name na=new name()) like wise.
    please let me know if there any possible way to do that.
    I am just passing the name of class by string variable then i wanted to make a instance of the class which come through the variable value.
    thanx.

    Either cast the object to a HelloWorld or use the reflection API (Google it) - with the reflection API you can discover what methods are available.
    Note: if you are planning to pass in various string arguments and instantiate a class which you expect to have a certain method... you should define an interface and have all of your classes that you will call in this way implement the interface (that way you're sure the class has a method of that name). You can then just cast the object to the interface type and call the method.
    John

  • How to typecast an object, if the target class name is stored in a str var

    Hi,
    I have a method, in which i will receive an object as an attribute. I need to typecast it to another class, and that class name is stored in a string variable.
    public void printContent(Object obj)
    /* Here i have a variable strClassName - in which a class name is stored.
    I need to create a variable for that class and type cast the object obj into that class. */
    Please kindly help me to find out a way to do this.
    Thanks in advance

    Typecasting does one thing: it enables you to store an object in a reference variable of the target type (if it is of a type which is allowed to be in that variable). It doesn't alter the object in any way.
    Therefore it simply isn't meaningful to talk about typecasting to a type name known only at run time. The whole point of typecasting is to tell the compiler to treat a reference as being of a specified type.
    I don't know what you're trying to do but I think you should probably be looking at the reflection api, getting field an method information from the object's Class object.

  • How to create a new file  having a name that is stored in a string

    Hello friends i am new to java and i need your help .
    I have a string which will take different values at run time. I want to create a file which has the same name as stored in the string . Can anyone help me?

    The Java Almanac example I linked to uses createNewFile() - the API documentation is not particularly clear about exactly what happens if c:\some\value\assigned\at doesn't already exist. But you're only a small experiment away from finding out!
    Another page gives examples of directory creation.
    http://www.exampledepot.com/egs/java.io/CreateDir.html
    Once (or if) the file is created using a File then, yes, that File is the name of the file: parent directories and all. If you create a FileReader based on the File it will read from the right place.

  • Convert exponent stored in a string to decimal

    I have the value 8.000000000000+E01 stored in a string. I want to display the value as 80.
    Please help. Is there any standard function module for this ???

    Try this code -
    data: i_s type string value '1E-02',
    i_f type f, " value '1E-02',
    i_p(12) type p decimals 5.
    write: / i_s.
    i_f = i_s.
    write:/ i_f.
    i_p = i_f.
    write: / i_p.
    Regards,
    Amit

  • Using a variables value as the name of another variable

    Hi, i'm new to java and i've been trying to write a little program. I was wondering whether it is possible to use the value of a variable as the name of another variable.
    This is what i have so far: When i run my java program numerous Animal objects are created with names like ani01, ani02, ani03. These objects have functions like getName() etc. When i type in one of these codes into the command line it gets stored in a variable called 'input'. Everything's fine up to here.
    But i need a way to access the correct Animal from my input. instead of doing countless switch statements on the input.
    If i type "ani02" i want it to return the animals name by calling ani02.getName()...
    how do i do this? i'd appreciate any help. thanks.

    If you were doing this based on user input, then you
    wouldn't have to do a lot of typing. Mmm?I'm sorry i don't get your meaning... ? I am doing this based on user input am i not?
    All i want to do is access the correct Animal object depending on the user's input... so if they type in ani01 it would return 'Elephant' (or whatever) using ani01.getName().
    Maybe i'm going about this the wrong way or something?.. I have about 30 animals. they each have a name, continent, quantity. I have an Animal class that has functions like getName(), setName() etc. When the program starts, 30 objects are created
    Animal ani01 = new Animal("Elephant",3000,"India");
    Animal ani02 = new Animal("Panda",200,"China");etc...
    I want to be able to get information about any one of these animals by typing something at the command line...
    so i type in something (i just thought the name of the object would be the best thing to type in) and i get the info about elephants (or whatever) from the relevant object.
    how would you do this?

  • How to put the column name and variable value in the alert message.

    Dear,
    how can i put the column name and variable value in the alert message text. i want to display an alert which tell the user about the empty textboxes. that these textboxes must be filled.
    Regards:
    Muhammad Nadeem
    CHIMERA PVT. LTD.
    LAHORE
    [email protected]

    Hello,
    The name of the item that fires the current trigger is stored in the :SYSTEM.TRIGGER_ITEM system variable.
    The value contained in this item can be retrived with the Name_In() built-in
    value := Name_In( 'SYSTEM.TRIGGER_ITEM') ;
    LC$Msg := 'The item ' || :SYSTEM.TRIGGER_ITEM || ' must be entered' ;
    Set_Alert_Property('my_alert_box', ALERT_MESSAGE_TEXT, LC$Msg ) ;
    Ok := Show_Alert( 'my_alert_box' ) ;
    ...Francois

  • How to perform a select op on a table whose name is contained by a variable

    I am using Oracle SQL*Plus client.
    declare
    tablename_var varchar(10); LOOK HERE
    date_var date;
    begin
    select sysdate
    into date_var
    from &tablename_var; LOOK HERE
    dbms_output.put_line('The system date is '||date_var);
    end;
    The above code prompts the user to enter a value for the variable tablename_var, once the user enters 'dual' on prompt... The system date is given as output.
    declare
    tablename_var varchar(10):='dual'; LOOK HERE
    date_var date;
    begin
    select sysdate
    into date_var
    from tablename_var; LOOK HERE
    dbms_output.put_line('The system date is '||date_var);
    end;
    This code fails and gives an error. I understand. Engine interprets it as... trying to perform a select operation on a variable, and says a table or a view is expected.
    Can someone please tell me what to do, to perform a select operation on a table whose name is contained by a variable, like above?

    Hi,
    Welcome to the forum!
    You need Dynamic SQL if the table- or column names are variables.
    Getting the current date isn't a good example; you could get that without a query simply by saying
    date_var := SYSDATE;Also, SELECT ... INTO will raise an error if the query does not return exactly 1 row.
    In the example below, let's get the latest entry_date from a given table:
    For example:
    declare
         tablename_var     varchar(10);
         date_var      date;
         sql_txt           VARCHAR2 (1000);
    begin
         tablename_var := 'table_x;
         sql_txt := 'select  MAX (entrydate)'
              || '  from  ' || tablename_var;
         dbms_output.put_line (sql_txt || ' = sql_txt');    -- Not essential, but recommended
         EXECUTE IMMEDIATE  sql_txt  INTO date_var;
         dbms_output.put_line ('The latest entry_date is ' || date_var);
    end;Dynamic SQL involves creating a string that contains the SQL statement. Displaying the string is purely optional, of course, but it's a very good idea when writing and de-bugging code. Remember to comment-out or delete the display before moving the code into Production.
    For an exercise, make the column name a variable, instead of the hard-coded entry_date.
    Edited by: Frank Kulash on Nov 5, 2009 9:20 AM

  • How to set variable values in Stored Procs

    Hi all,
    please excuse my newbie questions - I've spent too long using SQL Server......
    Anyway,
    I'm playing with SP basics and was wondering how I can set a variable value in a stored proc, ideally getting a value from a table or some select .
    for instance...........
    CREATE OR REPLACE PROCEDURE RPT_SP_ANT_TESTING
    P1 IN NUMBER,
    P2 IN VARCHAR2
    IS
    TmpNum NUMBER;
    TmpStr VARCHAR2(255);
    BEGIN
    --How do set these?
    SET TMPNUM := SELECT Count( * ) FROM ALL_TABLES;
    SET TMPSTR := P2 + '_APPENDED';
    INSERT INTO TEST_TABLE
    ( STRINGFIELD, NUMBERFIELD )
    VALUES
    ( TmpStr, TMPNUM )
    END;
    Regards
    DC

    Some ways are...
    setting directly
    x := 1;
    setting from a select use INTO clause
    select 1 into x from dual
    setting from a select into a collection type use BULK COLLECT INTO
    select name bulk collect into lName from your_table.
    It would be better if you read the document.
    Thanks,
    Karthick.

  • Get variable values from a stored procedure

    I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables.  I would rather get the 4 variables
    from a stored procedure (which returns all of these 4 values and more) but not sure how to do so.  Below is the code for getting the 4 variable values in my current sp.
    DECLARE @TotalCarb real;
    DECLARE @TotalPro real;
    DECLARE @TotalFat real;
    DECLARE @TotalLiquid real;
    SELECT @TotalCarb = ISNULL(TotCarb,0),
    @TotalPro = ISNULL(TotPro,0),
    @TotalFat = ISNULL(TotFat,0),
    @TotalLiquid = ISNULL(TotLiq,0)
    FROM dbo.vw_ActualFoodTotals
    WHERE (MealID = @MealID);

    You can replace the view with inline table valued user-defined function:
    http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
    See example: SQL create  INLINE table-valued function like a parametrized view
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Maybe you are looking for

  • Spry Menu Bar Submenus Not Showing

    Hi! This is the first time I have ever used Spry .My Horizontal Spry Menu Bar Submenus are not working in ANY browsers whatsoever and I'm not sure whats wrong. My website is www.poor2chic.com. I have pasted a copy of my SpryMenuBarHorizontal.css as w

  • Why Javascript can't get value in Struts?

    I have a button in Struts,when click this button,it will show a value in Struts,like follows: <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %> <script language="JavaScript"> function a(){ alert(username.value); </script> <form:form action="

  • How to bind an element in an arrayList to a table column

    Hi everyone, I need your help. I have an ObjectListDataProvider to bind a class MyClass to a table. Inside of MyClass, there is a property called dynNumOfElements of type ArrayList. I need dynamically create the columns of the table to match the numb

  • Direct the output of query results to a table

    Hi, I would like to know as how to transfer the results of a query to a table. eg: Select * from employee into <Tmp_table> Hence I would have a copy of employee table in the newly created Tmp_table. Thanks in advance Azeez

  • Load Testing an Oracle Application

    Hi , Kindly advice what are the best performance testing tools for an application housed completely in Oracle database and rendered by OWA technology . Also the application is so built that the displayed attributes are picked from the tables . Each p