GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  Programming  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 312 of 928    Print  
Tell me o/p of the mentioned code fragment.

String s1 = "shailesh";
String s2="shailesh";

System.out.println(s1.equals(s2));
System.out.println(s1==s2);
Answer is
true
true

Every time we make any string constant same memory referenced will be assigned if the string constant is same. That's why both obj. s1 and s2 refer to same memory.



  
Total Answers and Comments: 0 Last Update: November 05, 2005     Asked by: Shailesh 
  
 Sponsored Links

 

No answers are posted for this question yet.
Be the first to answer it!


 Related Questions

Latest Answer : CASE1:       String s3 = "hi";        String s="hi";        String s2=s3;                ...

Latest Answer : 1.The current length of a StringBuffer can be found through length(). 2.The total allocated capacity can be found via capacity(). Example: class Demo { public static void main(String a[]) { StringBuffer s=new StringBuffer("Welcome"); System.out.println(" ...


Latest Answer : String - ImmutableStringBuffer - Mutable ...

Latest Answer : Wrapper Classes correspond to the primitive data types in Java, as String is not a datatype in java, hence it is not a wrapper class. ...

How to use java.net.SocketImpl in Java Network Programming.Example Code which uses this java.net.SocketImpl Class.

View Question | Asked by : rupesh

Latest Answer : Hai,== will check the equality of the references of the objects where as.equals will check the equality of the content. ...
Read Answers (1) | Asked by : Beena

LET US TAKE A CASE:IF I COMPILED A .JAVA FILE AND I GOT .CLASS FILE,SUPPOSE IF I TAKE .CLASS FILE IN A FLOPPY AND TRY TO RUN ON THE OTHER MACHINE,WILL THE SYSTEM REQUIRED JDK OR JRE.
OTHER SYSTEM REQUIRED ONLY JDK NOT JRE,JDK IS A PART OF THE JRE(java run time enviornment) 

please give me answer ,if know with code also 
Latest Answer : We need to consider different paramaters when chossing between the drivers. The following summarizes the types of drivers to use in different situations. Performance with stored procedures: Type 2Scalability: Type 3, Type 4Transparent Application Failover: ...
Read Answers (4) | Asked by : siddu


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

jQuery Table Row Finished Code

jQuery Table Row Finished Code The Finished Code Our second example page has demonstrated table row striping highlighting tooltips collapsing expanding and filtering Taken together the JavaScript code for this page is mosgoogle geshibot lang php" document ready function var highlighted
 

jQuery Interacting with Other Code

jQuery Interacting with Other Code We learned with our sorting and paging code that we can t treat the various features we write as islands The behaviors we build can interact in sometimes surprising ways; for this reason it is worth revisiting our earlier efforts to examine how they coexist with t
 

jQuery Completed sorting and paging code

Learning jQuery The Finished Code The completed sorting and paging code in its entirety follows mosgoogle geshibot lang php" fn alternateRowColors function tbody tr odd this removeClass even addClass odd ; tbody tr even this removeClass odd addClass even ; return this; ; document
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

C++ String Representation and Handling

C String Representation and Handling In this C tutorial you will learn about string representation and handling how is string represented end string notation initializing char array character representation string literals example programe to understand the character array concept and the accessing
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

JavaScript String Object

JavaScript String Object In this JavaScript tutorial you will learn about String Object purpose of string object in JavaScript purpose of string object indexof method lastIndexOf method and substring method along with syntax and example mosgoogle center Purpose of String Object in JavaScript The mai
 

Convert a String into an Integer

How to convert a string into an integer in C program? This is done by using the function named as atoi(). This function atoi() is present in the header file named as <stdlib.h>. When programmers use this function they must include the header file by the statement #include <stdl
 

String handling functions

What is the string handling functions present in header file <string.h>? There are number of string handling functions present in string.h. In other words if a programmer uses any of the function present in string.h then they must include the header file as #include <string.h&am
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape