Small clarification in String literals

Hi
System.out.print((hello == ("Hel"+"lo")) + " "); Returns "TRUE"
Reason:Strings computed by constant expressions compile time and then treated as if they were literals.
Is it true?String Literal memory allocation at compile time or runtime?
Thanks
**smile

AmarKamat wrote:
Works differently if any part of the concatenation is a variable.Can you explain this in more detail or provide some more pointers?If any part of what's being concatenated is not a compile-time constant, then rather than producing a single literal that goes into the pool, the compiler produces code to execute at runtime that builds up the string using StringBuilder.append or StriingBuffer.append of some combination of runtime expressions and String literals, depending on what the specific pieces are. You can use javap to see the generated bytecode.

Similar Messages

  • Small clarification of Opening balance.

    Hi SDN Experts,
    i want small clarification. regarding my report, my report is displaying  Opening Balance, Line Items and Closing balance for given GL accounts, comp code and posting date..
      my problem is it is working good,  for those GL accounts having Line Items, but problem its not displaying O.bal for GL accounts those are not having Line Items.
       but my requirement is i want print all given GL accounts with  0.00 line Items for those r not having Line Items.
    plz anyone can help ,
    Thanks & Regards,
    sudharsan.

    Hi Anji Reddy Thanks for ur quick replay,
      in my report am using, GLT0 for O.balance and BKPF , BSEG for Line Items.
    Regards,
    sudharsan.

  • Error SQL70015: Error validating element [dbo].[GetDocument]: Deprecated feature 'String literals as column aliases' is not supported

    Using MS SQL Management Studio 2012 attempting to export (from GoDaddy) a .bacpac database for import to Azure and get the error message listed in the Title (String literals as column aliases is not supported on SQL Azure). There was a discussion of this
    problem in mid-2013, but it ended with saying that this was a bug with Azure validation, but had been fixed and did not require rewriting of databases. Anyone with a clue how to successfully export/import around this?

    Hello,
    A string enclosed in quotation marks used as a column alias for an expression in a SELECT list is not support in Windows Azure SQL database. Please use "expression [AS] column_alias" instead of " 'string_alias' = expression ".
    In your case, you can try to create an application with in SSDT and use Schema Compare to filter out and fixed incompatible objects, and then deploy the database to Windows Azure SQL database.
    Reference:
    Use SQL Server Data Tools to Migrate a Database to Azure SQL Database
    Migrating a Database to SQL Azure using SSDT
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • What is the Quoting Mechanism for String Literals?

    Oracle 10G enterprise edition
    Hi all,
    I am trying to use the new feature support for string literals in 10G.but unfortunately it returns an error. Is there any settings to be done to get implemented with this feature?
    BEGIN
    DBMS_OUTPUT.put_line ('This is ram''s string!');
    DBMS_OUTPUT.put_line(q'[This is ram's string!]');
    END;
    ERROR:
    ORA-01756: quoted string not properly terminated
    Thanks
    Ram

    Art in oracle wrote:
    Oracle 10G enterprise editionAre you sure you are using 10g? (which version?)
    It works ok for me... (10.2.0.1)
    SQL> select q'[This is fred's quoted string]' from dual;
    Q'[THISISFRED'SQUOTEDSTRING]
    This is fred's quoted string
    SQL> set serveroutput on
    SQL> ed
    Wrote file afiedt.buf
      1  BEGIN
      2   DBMS_OUTPUT.put_line ('This is ram''s string!');
      3   DBMS_OUTPUT.put_line(q'[This is ram's string!]');
      4* END;
    SQL> /
    This is ram's string!
    This is ram's string!
    PL/SQL procedure successfully completed.
    SQL>

  • Clarification on strings

    hi all
    I have two string
    String blank ="";
    String sometext = "test";
    when i use
    "".equals(blank) ---> returning true
    "" == blank ---> returning false
    this is working as expected but when i am using
    *"" != blank ---->returning false*
    *"" != sometext --->returning true -----> dono the reason why?*
    Cansome explain me the reason/behaviour of the text in bold
    Thanks
    diana

    Diana12 wrote:
    Ecellent.....!!!
    Thanks a ton for the help.
    is this the same with string object's and how does intern() react with objectsI don't understand your question. All Strings are objects.
    String s1 = "abc";
    String s2 = new String("xyz");This code has two String literals in it, abc" and "xyz". Therefore, when the class is loaded, two String objects will be created in the constant pool, one for "abc" and one for "xyz".
    When we hit the first line of code, the RHS evaluates to the reference to the "abc" in the constant pool, so that reference value is copied into s1. The reference variable s1 now holds a reference that points to the String object "abc" in the constant pool.
    When we hit the second line, the new operator tells us to create a new String object. It's the constructor that takes a reference to an existing String object. In this case that reference evaluates to the refer to the String object "xyz" in the constant pool. A new String is created, and its contents are copied from the one in the constant pool. The new operator returns a reference to that String object, and that reference value is copied into s2. The reference variable s2 now holds a reference that points to a String object "xyz" that is not in the constant pool.
    There are now 3 String objects--"abc" and "xyz" in the constant pool, and "xyz" in the normal part of the heap, not in the constant pool. They're all String objects, and they're all the same except for where in memory they live and which characters they hold.
    There are 2 reference variables, s1 and s2, that hold references pointing to 2 of those String objects.
    If we call "abc".intern(), "xyz".intern(), s1.intern(), or s2.intern(), nothing happens. Three of those references point to a String object already in the pool, and the last one, s2, points to an object that's not in the pool, but has the same contents as one in the pool, so nothing is done.
    String s3 = s1 + s2;
    String s4 = s3.intern();This creates a brand new String, one whose contents are not already in the constant pool. The s4 line make a copy of that string, "abcxyz" in the pool, returns a reference to that new String object, and sticks that reference in s4. Note that the s3 variable and the non-pooled "abcxyz" String object it refers to are both unaffected by the s4 line.

  • Small Clarification

    Hi all,
    I need a basic clarification.There are many datasources in R/3 (ECC) which has to be replicated as
    3.5 infosurces and we need to modify transfer rules and update rules.
    There are some datasources where we can use them as 7.0 datasources and transaformations needs to be used.
    Please explain which datasources are still 3.5 and which are available as 7.0
    Is there any specific procedure to follow
    Thanks

    Hi Pallavi,
    Once you changed SAPGUI version, Basically there are two types of data source avaliable, those are,
    1). Emulated data source ( called as 3.x data source)
    2). Data source ( 7.x data source )
    These two we can idetified easly based small rectangle box. If you observe closely, If you find any small rectangle box on left side of data source which means this is 3.x data source. otherwise that is 7.x data source.
    Any clarifications most welcome.
    If u r problem solved, assign points.
    Thanks & Regards,
    Kotresh

  • Problems with string literals in ejb-ql's

    I have a couple EJB-QL's that look like:
    <![CDATA[SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r']]>
    which used to work in Orion without a problem but in OC4J I get the following errors:
    com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    at com.sun.ejb.ejbql.parser.EjbQLParser.parse(EjbQLParser.java:226)
    at com.sun.ejb.ejbql.EjbQLDriver.parse(EjbQLDriver.java:86)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQLForEjbQLQueries(SQLGenerator.java:628)
    at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:270)
    at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:1947)
    at com.evermind.server.ServerComponent.init(ServerComponent.java:199)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDeployment.java:645)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:513)
    at com.evermind.server.Application.postInit(Application.java:429)
    at com.evermind.server.Application.setConfig(Application.java:136)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1479)
    at com.evermind.server.ApplicationServer.initializeApplications(ApplicationServer.java:1436)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1099)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:93)
    at java.lang.Thread.run(Thread.java:479)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:49)
    Error in application ACME Portal: Error loading package at file:/C:/dev/staging/portalstudio/ee/image/deploy/portal/portal-ej
    b.jar, Failure to initialize EJBQL descriptors: com/sun/ejb/ejbql/StringLiteral
    EJB QL statement : 'SELECT OBJECT(o) FROM AssignedStatus AS o WHERE o.recipientID = ?1 AND o.statusID = ?2 AND o.state <> 'r'
    EJB QL method : public abstract com.mongoosetech.reputation.ejb_entity.AssignedStatus com.mongoosetech.reputation.ejb_enti
    ty.AssignedStatusHome.findByRecipientIDAndStatusIDNotRevoked(java.lang.String,java.lang.String) throws javax.ejb.FinderExcept
    ion,java.rmi.RemoteException
    Am I doing something wrong here? These QL's work in several other App Servers so I am lost as to why this doesn't work.

    Kevin,
    We are aware of this bug in the developer's preview and will be fixed when next version of OC4J 9.0.3 will be released.
    regards
    Debu Panda
    Oracle

  • SPARQL query through Jena adaptor not work when string literals used

    Hi,
    When I executed the following SPARQL query through Oracle Jena adaptor:
    SELECT ?personHasFirstName WHERE
    {?personHasFirstName foaf:firstName ?name . }
    I got the expected results.
    However it won't return anything when I narrowed the query to match a particular name like below:
    SELECT ?personHasFirstName WHERE
    {?personHasFirstName foaf:firstName \"Julie\" . }
    I also tried the Filter approach:
    SELECT ?personHasFirstName WHERE {?personHasFirstName foaf:firstName ?name . FILTER (?name =\"Julie\") }
    It still doesn't return any results.
    I saw from the release notes about the bug dealing with "\". My guess is that the above behavior is caused by that bug. What is the suggested way to walk-around this? Thanks,
    Weihua

    Could you please try this? It works as expected on my machine.
    GraphOracleSem graph = new GraphOracleSem( oracle, modelName);
    ModelOracleSem model = new ModelOracleSem(graph);
    Node sub = Node.createURI("http://test.com/employee123");
    Node pre = Node.createURI("http://xmlns.com/foaf/0.1/firstName");
    Node obj = Node.createLiteral("Julie");
    graph.add(Triple.create(sub, pre, obj));
    String queryString =
    " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
    "SELECT ?person WHERE { ?person foaf:firstName \"Julie\" . } ";
    QueryExecution qexec = QueryExecutionFactory.create(
    QueryFactory.create(queryString), model);
    try {
    ResultSet results = qexec.execSelect();
    while (results.hasNext()) {
    QuerySolution soln = results.nextSolution();
    psOut.println("runQuery: soln " + soln);
    finally {
    if (qexec != null)
    qexec.close();
    output snippet:
    runQuery: soln ( ?person = <http://test.com/employee123> )

  • A small clarification in Exception handling

    Please find the simpe program given below on Exception handling I have asked my query at the end of the program
    This program is about throwing a user defined exception when Command line arguments satisfieds one of the checked conditions. Thanks in advance:
    class myexcep extends Exception
    class exception
    public static void main(String arg[])
    try
    for(j = arg.length-1;j>=0;j--)
    checkfood(arg[j]);
    catch(myexcep e1)
    System.out.println("Exception " +e1);
    System.out.println("I dont like this ifood");
    e1.printStackTrace();
    public static void checkfood(String a) throws myexcep
    if (a.equals("Pizza") | a.equals("Brocolli") | a.equals("Pasta"))
    throw new myexcep();
    System.out.println("I like this food " +a);
    The program complies and runs succesfully. After compilation if I give
    c:> java exception cabbage Pizza sub
    3rd and 2nd arguments are evaluated sucessfully and a exception is thrown, when argument "Pizza" is encountered which is succesfully caught by catch block. SO program ends there without even looking at my first argument cabbage.
    Can anyone give me a suggestion as of how to evaluate String "cabbage".

    Swtich the for and the try ... like this:
        for(int j = arg.length-1;j>=0;j--) {
          try {
            checkfood(arg[j]);
          } catch(myexcep e1) {
            System.out.println("Exception " +e1);
            System.out.println("I dont like this ifood");
            e1.printStackTrace();
        }

  • Unicode in string literals

    Hi,
    Some unicode characters are refusing to be 'escaped' when placed into a string literal.
    For example, "\u1fff" results in the 5 char long string "u1fff" - the backslash is stripped and that's it.
    There appear to be many other characters that also behave like this.
    Anyone know what's up with this? Are such chars illegal or something?
    Is there any list of these chars?
    Bye!
    Mark

    I don't think Unicode 1FFF exists (it's blank). For example 1FF2 does exist and works fine:
    textfield.text = "\u1ff2";
    // you get ῲ
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • 16-bit string literals

    How can you specify a string literal that compiles to an array of 16-bit units? "string" compiles to 1-byte char* and L"string" compiles to 4-byte wchar_t but we need a syntax to specify a string of 2-byte unsigned short.

    I'm reasonably confident that there is no 16-bit driver that works with an 8i client. I'd suspect that the old 16-bit drivers can probably be used to connect to an 8i database from an older client.
    Justin

  • String literals in Actionscript missing characters?

    I'm putting together a gallery/info viewer in Flash for a fraternity I'm in. What I have it doing is:
    -A thumbnail of each member's picture is visible
    -When the thumbnail is clicked, a picture is called into a UILoader at the top of the screen, and a string is called to be placed into a dynamic textbox next to the UILoader.
    Here's the code for my thumbnail...
    (currentData.currentPic is the location for the UILoader)
    myLastName.addEventListener(MouseEvent.CLICK, myLastNameLoad);
    function myLastNameLoad(e:Event){
        currentData.currentPic.source = "../NewSinfonia/myLastName.jpg";
        infoText.text = "First Last \n  Initiated Fall 10 \n Saxophone Performance '13 \n Webmaster";
    And here's what I get when I click on the thumbnail in the movie preview or when I open it in HTML in Firefox:
    First Last
    nitiated Fall
    Saxophone Performance
    Webmaster
    So, random characters are missing, and the same characters (by which I mean the I in Initiated, both years, etc., not the 10th character or whatever) are missing throughout all forty-or-so thumbnails. Everything else (picture loading, etc.) is working fine. I'm working out of "the official training workbook from Adobe Systems" for guidance, and the example they had similar to this involved pulling .txt files to load into the box, which I can do if I need to, but I'd rather just keep it this way. Anyone have any ideas? All help is appreciated.

    click on your textfields (to select them) and in the properties panel click the embed button:
    http://help.adobe.com/en_US/flash/cs/using/WSb03e830bd6f770ee21a3597d124daee0526-8000.html

  • How to embed string literals in pl/sql?

    DECLARE
    message varchar2(50) := ''That''s tutorialspoint.com!'';
    BEGIN
    dbms_output.put_line(message);
    END;
    I have to get out put like this below but when am trying to do so it is not displaying any output ....plz suggest what might be wrong in this code?
    output
    That's tutorialspoint.com!

    Dsrc00 wrote:
    DECLARE
    message varchar2(50) := 'That''s tutorialspoint.com!';    /*modified*/
    BEGIN
    dbms_output.put_line(message);
    END;
    I have to get out put like this below but when am trying to do so it is not displaying any output ....plz suggest what might be wrong in this code?
    output
    That's tutorialspoint.com!
    Hi,
    Single quote you have to put at the begining and the end of a string.

  • How does Java Handle String Literals Setting to Null for Identical Values ?

    Suppose,
    String s1="Java";
    String s2="Java";
    Now if i am not wrong only one value(bit pattern) "Java" exists in the heap and both s1 and s2 are pointing to it.
    If i set s1 to null,
    s1=null;
    Won't s2 be affected (it is not getting affected actually..)
    What could be the cause for this ?
    Thanks in Advance.

    amtidumpti wrote:
    So is it something like ....
    Variable         Memory Address   Value
    s1                      0234234           "Java"
    s2                      0234235           "Java"
    is s1 is set to null :
    Variable         Memory Address   Value
    s1                      0234234           null
    s2                      0234235           "Java"
    No. In your model here, a variable's value is a String object. It's as if your entire house exists on my s1 paper, and an exact duplicate house with all the same contents exists on my s2 paper. In Java, no variable or expression ever holds an object. No value is ever an object.
    It's more like this:
    Variable         Memory Address         Value
    s1                      0234234           11223344
    s2                      0234235           11223344
    is s1 is set to null :
    Variable         Memory Address         Value
    s1                      0234234           null
    s2                      0234235           11223344and 11223344 is, roughly speaking, the "address" where the String object holding "Java" is stored.
    And in both your model and mine, "Memory Address" is not the address that the variable holds. Rather, it is the address that corresponds to what we humans have named s1 and s2 for our convenience.
    Edited by: jverd on Apr 10, 2009 11:43 AM

  • Small clarification how to do

    hellow experts,
    i have one small doubt.
    we have table p0580, in that we have one field with data type as currency.now i want to display it as value of type Character.
    Is it possible or not.
    Pls clarify my doubt.
    with regards
    babu.

    hai,
    my cod is like this
    TYPES: BEGIN OF ty_wage,
             lgart TYPE t512t-lgart,
             lgtxt TYPE t512t-lgtxt,
             betrg TYPE ansal_15,
             END OF ty_wage.
    data :wa_wage TYPE ty_wage.
    CONCATENATE '|' wa_wage-lgtxt '            |' wa_wage-betrg INTO it_output.
            APPEND it_output.
    and it gives error like this.........
    wa_wage-betrg must be character-type data object.
    i did all this in Function Module
    points will be rewarded
    with regards
    babu

Maybe you are looking for

  • HT204380 I can't use Facetime. Checked all settings are correct.

    I cant use Facetime. I see the missed calls. I can't place a call either. Confirmed settings are correct following the troubleshooting guide. My WiFi works fine (can send text /o issues). My contacts are all iPhone users.

  • How make a button enable property "true" while i am clicking a row from datagrid in mxml flex4 app

    hi friends, i am new to flex, i am doing flex4 web application with mxml tags. i have struck in this place,please give some idea. i have one data grid with 5 rows and 4columns,and also i am having one button (property enable is false). while i am cli

  • Customizing Portal favourites

    Hi, I would like to customize the Organize Favorite iView e.g the current Organize favorite allows to delete only one item from the entry's context menu. My requirement is to add check boxes and delete multiple entries. Please provide me with inputs

  • Overview SAP HCM country based infotypes

    Dear all, I am in search of an overview of all Sap HCM infotypes. Per infotype I need to know whether it is an infotype common to all countries (such as: 000,0001,0002,0003,0006,0007,0008,0009,0014,0015) or a country specific infotype (U.S. Benefits

  • Taking HOURS to copy music files from one external hard drive to another...

    Am I doing something wrong? Have a about 5,000+ songs on an external hard drive (hooked to my pc). I have networked the PC through my mac mini and I'm now copying those files onto a new/fresh external hard drive hooked to the mac mini. It's successfu