Home Answers Viewqa Java-Interview-Questions java fundamental question related to string

 
 


sajna cs
java fundamental question related to string
0 Answer(s)      2 years and 2 months ago
Posted in : Java Interview Questions

public class Myclass { Public static void main(String args[]) { String s=â??helloâ??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(â??aâ??); If(s.equals(sb)) system.out.println(â??bâ??); If(sb.equals(s)) system.out.println(â??câ??); } } Output?

a) the pgm will throw ClassCastException b) compilation fails since s==sb illegal c) compilation fails since s.equals(sb) illegal d) print c

View Answers









Related Pages:
java fundamental question related to string
java fundamental question related to string  public class Myclass { Public static void main(String args[]) { String s=â??helloâ??; StringBuffer sb=new StringBuffer(s); Sb.reverse(); If(s==sb) system.out.println(â??aâ
java fundamental question
java fundamental question  public class WrapTest3 { Public static void main(String args[]) { String s="98.6"; // insert code here } } Which will cause compilation error: a) float f1=Float.floatValue(s); b) float f2=new Float
java fundamental question
java fundamental question  public class TestVarArgs { Public void display(Double i, double â?¦ j) { System.out.println(â??Double& var argsâ...;Double calledâ??); } Public static void main(String args[]) { New TestVarArgs
java fundamental question
java fundamental question  equivalent to 16>>2 ? a) 16/4 b) 16/2 c) 16*2 d) 16/2^2
java question related to objects
java question related to objects  what is the output of the following code? public class objComp { Public static void main(String args[]) { Int result = 0; objComp oc= new objComp(); object o = oc; if( o==oc) result =1; if(o
Java Related Question
","mangal","to","java"}; String name; SynchronizedModel(String nam) { name...","mangal","to","java"}; String name; SynchronizedModel(String nam){ name...Java synchronized method  Dear Friend, I have written below
Java Related Question
","to","java"}; String name; SynchronizedModel(String nam... msg[]={"Welcome","mangal","to","java"}; String name; SynchronizedModel...Java synchronized method  Hi, I have written below program
string related question
string related question  *q.1>how i dispaly the reference of string variableS ? eg:-String s1="my name"; Sring s2="your name"; here what is address of variable s1 and s2
Java and jvm related question
Java and jvm related question  What is difference between java data types and jvm data types
Java Related Question
Java Related Question  hi, Why java doesn't has primitive type as an object,whats an eligibility to have a primitive type as an object by the languages
java related question
java related question  How can we make a program in which we make mcqs question file and then make its corresponding answer sheet....like if we make 15 mcqs then java should generate it answer sheet of 15 mcqs with a,b,c d
Data base related question
Data base related question  sir my table has only one element...:odbc:oldp"); stmt2=con2.createStatement(); String st2="select * from pname order...) { e.printStackTrace(); } return regd1; } public static void main(String args[]) { raja p=new
String question
String question  which method is used in java to eliminate the duplicate elements in String?   import java.util.*; class RemoveDuplicates{ public static void main(String[] args){ String[] str = new String[] { "Where
string related
string related  As with any other object, you can create String objects by using the new keyword and a constructor. The String class has thirteen constructors that allow you to provide the initial value of the string using
Question
Question  Sir, give me a java program to count the number of tokens , given a string and a seperator
java related - Java Beginners
is void. String args[]-Java take's each argument as string. For more...java related  Why the "public static void main(Strings args... is necessary for a java class to execute it as a command line application
question
( to find out result from the given Java code ) Core Java interview questions...;import java.util.*; class Student{ String name; int marks1; int marks2; int marks3; int average; Student(String name,int marks1,int
question
and simple java script   // login.jsp <%@ page language="java" contentType...(); } return true; } User Name: Password: <%String st...; // validation.jsp <%@ page language="java" contentType="text/html; charset=UTF-8
Question
in connection database with the java code. import java.sql.*; public class MysqlConnect{ public static void main(String[] args) { System.out.println("MySQL
question
search using java swing .If i am clicking a search button then i want... of frame . please help me to create this and send me the source code using Java... extends JFrame{ public static void main(String[]args){ JFrame
question
javax.swing.text.MutableAttributeSet; public class Original { public static void main(String[] args... EditorPaneFrame() { setTitle("Java Web Browser"); setSize...(); String urlString = (String)urlStack.peek
Question related to Hibernate
Question related to Hibernate  Why do we use Set in child class in 1:many hibernate ,why can't we use Directly HashSet
question
search and send using java swing .If i am clicking a search button then i want... using Java Swing   I think this will help you, try this package...; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated
Related to multiple inhetitance - Java Beginners
Related to multiple inhetitance  Sir, Plz help me to solve this question. Q.1. Write a Progarm to illustrate the concept of multiple inheritance using interface
coding related - Java Beginners
{ public static void main(String[] args) throws IOException{ BufferedReader...)); System.out.println("Enter the lower string value"); String str = buff.readLine(); char.../java/java-conversion
Struts related Question
Struts related Question  Hi All, I have a one question on validation framework for client side validation please help me on that. suppose i don't want to put required=true in our JSP then what will happen. what error will come
project related question
project related question  1- how to insert a date through hibernate 2- how to insert exact time ,date separetly in the data base for current time date
JDBC ODBC related problem
JDBC ODBC related problem  i WANT HELP RELATED TO JDBC CONNECTIVITY...(); String course[] = {"Navakal","SandhyaKal","Pudhari","MidDay","Inqlab","BusinessLine...()); ERROR{ String str = (String
Core Java Interview Question, Interview Question
Core Java Interview Question Page 14  ... that is implemented in a language other than Java. Question: Can a for statement loop... state when it blocks on I/O. Question: To what value is a variable of the String
Frame related query - Java Beginners
Frame related query  hi..... i m having a query dat...can i open a frame inside another frame like dis.. m a new biginner of java n m finding...()); } } } public static void main(String args
jsp program related
folder. 4)Now create a jsp file:'hello.jsp' <%@page language="java"%> <%String st="Hello World"; %> Message is <%=st%> 5)Put this jsp file
Core Java Interview Question, Interview Question
Core Java Interview Question Page 23  ... and interfaces that are loaded by a Java program. Question: How does a try statement... add a double value to a String? Answer: The result is a String object. Question
Core Java Interview Question, Interview Question
Core Java Interview Question Page 9       Question: What are the uses of Serialization... ? Answer: StringBuffer is faster than String for concatenation. Question: What
Core Java Interview Question, Interview Question
Core Java Interview Question Page 5   ... enterprise java beans. To send objects between the servers in a cluster. Question... String for concatenation. Question: What is Runnable interface ? Are there any
thread related - Java Interview Questions
the monitor and proceed. public class WaitMethod extends Thread{ String st="Hello"; public static void main(String args[]) { WaitMethod wait=new WaitMethod...){} } public void valchange(String st){ this.st=st; try { synchronized
baaank acoounts related - Java Beginners
baaank acoounts related  hi all i have one code but that is not working kindly help me send me a working code as i a am totally new to java... for Savings account - Customer Name. - Customer Address of String type
related to java
related to java  what is mean of }); in java.i know that } is used to close a block of statement,) is used to close a statement and ";"is used after close a statement but i can not usderstood the use of }); together in a java
Restlet Frame work Related question
Restlet Frame work Related question  How to send data from client to server using Restlet framework. The main problem is i am not able to get data at server side. Can anyone post a complete program how to achieve
java question :)
java question :)  write java program to use vector in ArrayList... RemoveVectorElement { public static void main(String[] args) { Vector<String>... Element MUAYAD"); vc.add("Vector Element JAVA"); vc.add("Vector Element
java question
java question  i have a string like "My name is arvind.i live in bangalore.i study in college.".the problem is that i hav to break this string into three seperate lines
java question
java question  I have employee class that displays employee information based on id . class employee { int id; String name; String State; String City; String Area; } Now i need to display **employee name** based on state ,city
java question
java question  I have employee class that displays employee information based on id . class employee { int id; String name; String State; String City; String Area; } Now i need to display **employee name** based on state ,city
java Question
java Question  Design a class named rectangle to represent a rectangle. The Class contain: * Two double data fielda named width and heigth... width and height . *A string data field named color that specified the color
java Question
java Question  Design a class named rectangle to represent a rectangle. The Class contain: Two double data fielda named width and heigth... width and height. A string data field named color that specified the color
Related to Project
Related to Project  how speech to text project can be make in java? Please tell me the coding part therapeutically i know i have to use java speech api which offer two technology 1. speech recognization 2. speech syenthesis
Java Interview Questions - Page 2
. Question: What is the main difference between Java platform and other... (Java API) Question: What is the Java Virtual Machine... hardware-based platforms. Question: What is the Java API
my question is related to my project viz
my question is related to my project viz   Sir, my project is based on MR tracking system developed using struts framework, it has been developed in Net Beans the whole project is working except a jsp page named dayplan.jsp
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
String
String  how to print in between numbers if the question "String s = "1,2,3,4,5,6,8,-25"" out must be 1 2,3,4,5,6,7,8,9,10,upto25

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.