About Variable defining

hello,
1)Is
'Long variable' the same as 'long variable'? will they both compile?
2) i wrote a small program, and the named the CLASS Fruit. I then saved the file as fruit.java (notice the capitalization) . When i typed javac fruit.java, an error was given, however when i type javac Fruit.java(even thought the file doesnt exist), the program complies to a class file. why is that??
3) In a program i declare ' long ali=1L'
later in the program i wish to change the value of 'ali' to 8
do i type ali=8 or ali=8L?
thanks

so typing 8 or 8L doesnt make a difference? but i should type 8L for the sake clarity?Well, 'clarity' is all subjective, but basically, this is what's happening:
In general when the compiler sees lhs= rhs where 'rhs' is a literal
numerical expression, it attempts to cast the 'rhs' type to the 'lhs' type.
If it can do so without loss of precision, it will do so unless you've
explicitly given the type of the 'rhs'. In case of a trailing 'L', you're
explicitly telling that the literal has type long. Here are some examples:byte a= 123;  // fine: 123 fits in a byte
byte a= 255; // error: max byte value = 127
byte a= (byte)255; // fine again, you explicitly casted the value
byte a= 42L; // error: the compiler is not allowed to cast and byte != long
byte a=(byte)42L; // fine again, you explicitly casted the value
byte a= (int)42L; // fine because an int can be casted back to a byte again.
byte a= (int)10000L; // error: explicit int too big for a byte
byte a= (byte)(int)1000L; // fine: explicit cast to byte with loss of precision
byte a= (byte)1000L; // same as above
byte a= 3.14 // error: the compiler is not allowed to cast and byte != double
byte a= (byte)3.14; // fine again: you explicitly casted the value
byte a= (int)3.14; // fine because an int can be casted back to byte again
byte a= (long)3.14; // error: the compiler is not allowed to cast and byte != longDid this clear things up a bit?
kind regards,
Jos

Similar Messages

  • Report cannot access pl/sql table variable defined in Package Spec.

    Hi,
    I've created a package spec called pkg_report with a PL/SQL table variable defined called body_text_table. When I tried to compile the following code under the Before Report trigger:
    :desc := pkg_report.body_text_table(1);
    Oracle gave me the following error:
    Implementation Restriction: 'PKG_REPORT.BODY_TEXT_TABLE': Cannot directly access remote package variable or cursor.
    Does anyone have any idea about this error? Thank you for your time at looking at it.
    Regards,
    John

    You cannot directly access the package variable in a database package. The work around is to create a set_variable and get_variable wrapper function in the package body. See Metalink note 105838.1 for more info.
    A simple example:
    create or replace package my_package as
      my_var     number;
      function   get_variable return number ;
      procedure  set_variable (p_value in number) ;
    end ;
    create or replace package body my_package as
      function get_variable return number is
      begin
        return my_var;
      end ;
      procedure set_variable(p_value in number) is
      begin
        my_var := p_value ;
      end ;
    end;

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • Variables defined in Query designer not affecting the web template

    Hello,
    I have some variables defined in a query, through Bex query  designer.
    The selection screen to enter the values for the variables pops up when excuted on the web or in excel .
    But the variable selection screen does not pop up when i execute a web template where in i defined with the same query.
    Please suggest me why it is happening so..

    In WAD check in the General Properties whether you have unchecked the Force Variable Screen On Checkbox
    Other thing to check is whether you have personalized the selection screen??? After Executing the Report go to selection screen by clicking on the Variable Screen option. To the left side of each variable you can see the personalization icon. right click on that and select delete personalization.
    Hope this helps.

  • How to use global variable defined in planning area in FOX

    Hi guys
    I meet a situation that needs to use variables defined in planning area in FOX.How to code?
    My situation as follows:
    Two variables are defined in planning area,one is zcomp_code,the other is zfiscyear.
    There are two key figures in the planning area,one is sales volume,the other is delta(%).
    I want to use sales volume multiplied by delta(%) in selected zcomp_code and zfiscyear by users.
    Anyone can help?
    Thanks in advance.

    Hi Eric
    check this example
    in fox you shoud declare your data and after call your variable
    after this you could easily operate on data using the f4 for definig the right fox operators
    DATA FYEAR TYPE 0FISCYEAR.
    FYEAR = VARV(PLANYEAR).
    {0COPANETRV, FYEAR,CRA,020} =
    {0COPANETRV,FYEAR,CRA,020} *
    ({ 0CP_DELTAB,FYEAR,CRA,020} + 100 ) /100.
    {0CP_DELTAB,FYEAR,CRA,020} = 0.

  • Questions about user-defined functions

    Hello all,
    I've got some questions about user-defined function in a message mapping:
    1) How can I get the current date/time in format yyyy-mm-dd hh:mm:ss ? What is the java code for this?
    2) I want to use the StreamTransformation constant TIME_SENT, only this is not in the right time-zone.
    It is GMT and it should be CET (1 hour difference). How can I convert this in Java?
    Can somebody help me with this?
    Thanks in advance.
    Kind regards,
    Marco van Iersel

    Hi Marco,
    If the date format is fixed as you have mentioned,please use this:
                                    String test = "2009-03-27 23:15:30";
              String test1 = test.substring(11,13);
              if(!test1.equals("23"))
              int a = Integer.parseInt(test1);
              int b = a+1;
              System.out.println("b"+b);
              String c = Integer.toString(b);
                                    test = test.substring(0,10)+" " + c + test.substring(13,19);
                                    return test;
              if(test1.equals("23"))
              test = test.substring(0,10)+ " 00" + test.substring(13,19);
              return test;
                                    else return "";
    Kindly let me know if this works.
    Thanks.
    Regards.
    Shweta

  • Documentation about variable types & their processing in i_step = 1, 2 etc.

    Hello experts,
    is there any documentation about variable types and their processing in i_step = 1, 2 etc.? I know there is note 492504 "Dependent customer exit-type variables", but I don't understand, whether a variable which is NOT "Ready for input" will be processed in i_step = 1 or not  (quote of SAP library: "i_step = 1: Call takes place directly before variable entry."). I experienced coincidentally, that some variables not "Ready for input" will be processed there and some not.
    Furthermore it is an error, isn't it? Why has a variable without input possibility to be processed before input? Is this really the case?
    Confused, any hints are welcomed!
    Regards M.L.

    for I_STEP = 1
    Call before the variable screen .
    for I_STEP = 2
    Call after variable entry. This step is only started up when the same variable is not input ready and could not be filled at I_STEP=1.
    for I_STEP = 3
    In this call, you can check the values of the variables. Triggering an exception (RAISE) causes the variable screen to appear once more. Afterwards, I_STEP=2 is also called again.
    for I_STEP = 0
    The enhancement is not called from the variable screen. The call can come from the authorization check or from the Monitor.
    There is a good HOW to Guide which explains the importance of I_STEP :
    http://service.sap.com/~form/sapnet?_SHORTKEY=00200797470000078090&_SCENARIO=01100035870000000112&_OBJECT=011000358700002762582003E
    Another from SDN:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/bw-and-portals-05/five%20ways%20to%20enhance%20sap%20bi%20backend%20functionality%20using%20abap.pdf

  • Variables defined in JSP include files.

    hi..
    i was wondering how to access the variable defined in a JSP include file from the page where it is included.

    If you are thinking of scriptlets, then you would do it in the same manner that you would access variables local to your jsp. A word of caution - jsp pre-compilation may not work.
    A neater solution would be store it as an attribute in 'page' scope.
    cheers,
    ram.

  • How to read static variable defined java class from flex?

    This is a beginner question. If I use remoteClass to map a java class and a flex class, how can I access a static variable defined in java class from the flex code?
    Thanks!

    Static propeties are by default ignored in the blazeds for serialization. You can try using another global property in the java bean which maps to the value stored in the static property( Hopefully it should work)
    eg,
    public String instanceValue = ClassName.staticValue;
    Ref: http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=serialize_data_3.ht ml

  • In tag body how to access variable defined outside?

    Suppose the following jsp fragement: <% String x = "wwlhp"; %>
    <c:mytag>
      want to use variable x defined above
    </c:mytag>  anyone have ideas about which approach should i take? Thx a lot!

    Sorry, I have made a terrible mistakes:).

  • Ask help about  variable range

    1.if I define a variable at the start of the class: private JList flightsList;
    2.then write a method :public void doQuery( )
    String startAirport = (String)from.getSelectedItem();
    String endAirport = (String)to.getSelectedItem();
    String timeDate = date.getText();
    if( manager.getFlights(startAirport, endAirport,timeDate) != null )
         Flight [] flightQuery = manager.getFlights(startAirport, endAirport,timeDate);
         int length = flightQuery.length;
         String [] number = new String[length];
         System.arraycopy(flightQuery,0,number,0,length);
         //flightsList = new JList( number );
    3.then make a constructor,I want in the constructor invoke the method doQuery( ) ,then use
    code: flightsList = new JList( number );
         contents.add( new JScrollPane( flightsList) , BorderLayout.CENTER );
    I want to put arryaay number in the flightsList,then create a JScrollPane show the arraay number.
    But it does not work.I know it is the variable range,how to pass the number into the flightsList?
    I have thought about it for a long time.
    Please help me,thanks!

    I mean:
    example:
    public class look extends JFrame {
    //if I define a variable at the start of the class:
    private JList flightsList;
    //2.then write a method :public void doQuery( )
    String startAirport = (String)from.getSelectedItem();
    String endAirport = (String)to.getSelectedItem();
    String timeDate = date.getText();
    if( manager.getFlights(startAirport, endAirport,timeDate) != null )
    Flight [] flightQuery = manager.getFlights(startAirport, endAirport,timeDate);
    int length = flightQuery.length;
    String [] number = new String[length];
    System.arraycopy(flightQuery,0,number,0,length);
    //flightsList = new JList( number );
    3.then make a constructor,I want in the constructor invoke the method doQuery( ) ,
    public gui
    //use code
    flightsList = new JList( number );
    contents.add( new JScrollPane( flightsList) , BorderLayout.CENTER );
    in sort I want to put array number in the jlist( flightsList),then create a JScrollPane show the arraay number(number).
    //Your constructor assigns the private variable the value of what it is passed, then you can use it in other functions in the class.
    Is that what you are asking?
    no,I mean assingns a private variable,then write a method ,then invoke the method to put array number in the private variable.

  • VO with bind variable defined in SQL is not updated correctly

    Hi Experts,
    I have one simple question here, could you please help answer? Thanks a lot!
    I have 2 pages, the first page displays an employee table, the second page shows some details related to the selected employee. When select one employee and click on the detail button I can be naviaged to the second page and see the details for the selected employee. The vo used on the second page uses a bind variable called "empId" which is binding to a pageFlowScope value 'adf.context.pageFlowScope.empId', and this pageFlowScope value will be populated to the selected empId in detail button actionListener at runtime).
    The question here is, now the first navigating is ok, the detail page can show the correct information for the employee selected on the employee page, but when navigating back and choosing another employee, and then click on the detail button again, the detail page is NOT updated, it still shows the first selected employee information. I do debug the actionListener in the backing bean and the second selected empId does get passed to pageFlowScope.empId, the bind variable in the VO should get the new value, right? but why the second page does not get updated (query using the new bind variable value)?
    Thanks!
    Edited by: user774592 on Jul 20, 2011 11:13 PM
    Edited by: user774592 on Jul 20, 2011 11:15 PM
    Edited by: user774592 on Jul 20, 2011 11:15 PM

    Hi Timo,
    Thanks for you response! The JDev version I used is 11.1.2.0.0. Actually, they are different VOs, the 1st page is EmployeeVO, the second page is ResourceSummaryVO which binds the empId variable in SQL. The ActionListener code is as below.
    public void viewResSummary(ActionEvent actionEvent) {
    // Add event code here...
    DCBindingContainer bc = (DCBindingContainer)this.getBindings();
    DCIteratorBinding empIteBinding =
    bc.findIteratorBinding("SEmployeeView1Iterator");
    //Get employee id from the current selected employee record
    Row currentRow = empIteBinding.getRowSetIterator().getCurrentRow();
    Long employeeId = ((DBSequence)currentRow.getAttribute("EmployeeId")).getValue();
    //Set employeeId as a pageFlowScope object which will be used in ResourceSummaryPage
    AdfFacesContext.getCurrentInstance().getPageFlowScope().put("empId", employeeId);
    empId is defined using Bind Variable Dialog and is referenced in ResourceSummaryVO on the second page. I used the EL expression to defined its value to adf.context.pageFlowScope.empId which will be populated using above code at runtime.
    Again, thanks for your help!

  • ADF panel does not prompt for variable defined in ADF view object.

    I have created an ADF Panel, which allows the user to run a few simple queries against an Oracle database done using ADF view objects and ADF view links and ADF application module.
    One of these queries lookup detail information about a given database object (Table, view or whatever) from dba_objects. The SQL uses a parameter (:P_OBJ_NAME) that has a default value of “Departments”. If I run the ADF application module by itself outside of the ADF panel, all works fine, it prompts me to provide a value for the parameter :P_OBJ_NAME.
    As I said the panel contains the different ADF view links including the one that should prompt the user to provide a value for :P_OBJ_NAME. When I run the panel it does not prompt me for :P_OBJ_NAME, it just uses the default defined value “departments”.
    I hope I described my problem for every one to understand. The question obviously is how do I get the ADF panel to prompt the user to provide a value for parameter :P_OBJ_NAME, my expectation was that since the sql in the view object and the application module both are designed to prompt for a value for this parameter then the panel should do just that but it does not.
    You expert input would be most appreciated.
    Thanks.
    Bobby A.
    Edited by: Babak Akbari on Aug 13, 2009 8:34 AM
    Edited by: Babak Akbari on Aug 13, 2009 11:12 AM

    The prompting for a parameter is a feature we built into the ADF Tester - it is not a default behavior you get in your application when you just place a VO on your page.
    To get something like this expend the operations node under the VO in the data control palette, and drag the "Execute with parameters" operation to your page to drop it as a parameter form.
    This will provide your user a place to fill out the parameter and press a button to execute the query.

  • How to Access Variables defined in the PopUpWindow

    Hi Friends
    I am building a flex site using flex builder 2.....
    Here I need your help.....
    My Problem is how to store a variable from a popup window
    I have this problem while in the login window comes as popup
    while clicking login button in the page a popup where user
    can enter username and password...
    after submitting if the login is successufl the popup
    vanish...
    After a successful login I need to store the logged user name
    in the main index page but I am not able to store
    At first I created a variable 'loggedUsername' in the popup
    panel and after success log i assigned the username to it ... after
    it i am not able to get the loggedUsername..
    doubting I defined the variable in the main index.mxml page
    but this variable is not accessible from the loginwidow.mxml page
    where the popup will function...
    Heip me
    how to store the name if the user login is success..
    thanks
    Chintu...

    Lets say you have a public property in your application like
    public var name:String = "John Smith";
    to access this using an inline item renderer:
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox>
    <mx:TextInput text={outerDocument.name} />
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    To access variables of the applicaton you can use
    Application.application.name (for example) to reference "global"
    variables, so you might also use this technique. With an inline
    item renderer, the outerDocument property will refer to the
    component which contains the renderer.

  • Using xsl:import and trying to access a variable defined in another xsl

    Hi
    I am having a a.xsl file with contents liek this :
    <xsl:variable name="PersonId" select="'1910'"/>
    inside b.xsl i am importing a.xsl like
    <xsl:import href="a.xsl"/>
    <xsl:value-of select="$PersonId"/>
    This is working fine when i am testing it standalone.
    when i port the code to weblogic server (meaning when all the
    project related files are placed in proper location in
    weblogic) and start the application then i get the error msg :
    xsl:1031 variable not defined 'PersonId'.
    i tried giving the enite path like :http://localhost:7001/....
    even then problem remains unresolved.
    am i making any mistake ?
    Thank you
    Regards
    Jaya

    This works fine for me with Oracle XSL Processor 9.0.2C
    <!-- a.xsl -->
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:variable name="PersonId" select="1910"/>
    </xsl:stylesheet>and
    <!-- b.xsl -->
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:import href="a.xsl"/>
      <xsl:template match="/">
       <xsl:value-of select="$PersonId"/>
      </xsl:template>
    </xsl:stylesheet>Make sure you're using the latest version of the XDK in your
    weblogic environment.

Maybe you are looking for