Share on Google+Share on Google+

ripon
JAVA programme
1 Answer(s)      7 years ago
Posted in : JDBC

Ads

View Answers

November 20, 2009 at 11:45 AM


Hi Friend,

Try the following code:

import java.util.*;
public class String_Example{
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.println("Enter string:");
String st=input.nextLine();
//charAt() method returns the character at the specified index.
int index=4;
char ch=st.charAt(index);
System.out.println("Character "+ch+" is found at index "+index);
//concat() method concatenates the two string.
String str=" World";
String newString=st.concat(str);
System.out.println("After Concatenation, new string is: "+newString);
//length() method returns the length of the string.
int len1=st.length();
System.out.println("Length of string is: "+len1);
int len2=newString.length();
System.out.println("Length of new string is: "+len2);
//compareTo() method compare two string based upon the unicode value of each character in the String.
//If int value is 0, strings are same.If negative, first string is less than another and if positive first string is greater than another.
int com=st.compareTo("Hello");
System.out.println("The result is: "+com);
}
}

Thanks









Related Tutorials/Questions & Answers:
java programme
java programme   1.....programme for reading 10 values for 10 variables using scanner class 2....declares all types of primitive data inside main method
java programme
java programme   i have to write a java programe that calculates the average of 10 students in Test 1 ,Test 2 and Test 3....Values of the marks in all the test for a student should be hardcore.Ialso have to tell the maixmum
Advertisements
Java programme
Java programme  Write a program to get student grade for 3 different subjects, and display the CGPA for them
programme - Java Beginners
programme  java programme to implement stack operation?use stack to check whether a given string is polidrome or not  Hi Friend, Please...://www.roseindia.net/java/example/java/util/StackImplement.shtml Use following code
Java programme - Java Beginners
Java programme  Develop a multi-threaded GUI application using java application
Java programme - Date Calendar
Java programme  Can you provide me the coding for Date class provided by java util package
Problem on JAVA Programme
Problem on JAVA Programme  public class AA { int add(int i) { int y = i; y += 20; if (y <= 100){ y +=30;add(y);} System.out.println("Final Value of y : " + y); return y; } public static void main
JAVA programme - JDBC
JAVA programme  Prepare a class ?String_Example? following the basic functionality of ?String ?type of JAVA. Use of dynamic character arrays for such class is encouraged. Following is expected from the completed Program
JAVA programme - Java Interview Questions
JAVA programme  Perpare a class "package_example" following the basic functionality of "string" type in JAVA.Use of dynamic character arrays for such class is encouraged.Following is expected from the programme: a.Use of 3
programme
programme  Using an ATM, customer can access their bank accounts in order to credit/debit cash and check their account balances.You have to write c programme to implement a simple ATM for 15 customers. Initially you have to store
java programme - Java Server Faces Questions
java programme  Write a complete program, which prints all Fibonacci numbers that are less than 1600.  Hi Friend, Try the following code: public class FibonnaciSeries { public static void main(String[] args
How to add a file in GZIP file format in Java programme.
How to add a file in GZIP file format in Java programme.  Hi please help me. How to add a file GZIP File format in Java program. If example... in Gzip file format. For details visit http://www.roseindia.net/java/examples
menu driven programme
menu driven programme   calculate the area of circle, square, rectangle in menu driven programme in java
hotel management programme in c language?
hotel management programme in c language?  hotel management programme in c language
compiling programme IJVM
compiling programme IJVM  I TRY AND COMPILE THE PROGRAMME BELOW BUT HAS ERROR APPEAR ALL THE TIME,,CAN ANYONE CORRECT THE CODE AND WRITE UP THE NEXT METHOD FOR POWER IN THE PROGRAME AS WELL...URGENT // Program to read two single
please solve the programme
please solve the programme  Develop a java program to find the roots of a quadratic equation ax2+bx+c=0, with the following specification :- Class name :- Quad Data members float a,b,c,d, with a,b,c are the co-efficient
applet images sleeping programme - Applet
-------------------------------------------------------- Read for more information. http://www.roseindia.net/java/example/java/applet/ Thanks
making consistency of data member in the whole programme without using static keyword
making consistency of data member in the whole programme without using static keyword  In the below programme i use one boolean variable named check... . But the value of check variable is not maintained in the programme . we can
java
java  where i write java programme and how do i execute the programme
java
java  Write a programme in java to take the value of A and B as input and print the value of(A+B)3 and (A+B)2
java - Java Beginners
java  write a java programme to draw diagram for function f(x)=x*x
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
JAVA - Java Beginners
JAVA  WRITE A PROGRAMME FOR SIMPLE CALCULATOR  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Thanks
java - Java Beginners
java  write a programme to to implement queues using list interface  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/util/QueueImplement.shtml Thanks
Java GUI - Java Beginners
Java GUI  How to use JTray in java programme?  Hi friend, JTrayIcon jtc= new JTrayIcon(image); // jPopupMenu is a javax.swing.JPopupMenu jtc.setRightClickTarget(jPopupMenu); jtc.show(); Thanks
java - Java Beginners
java  Hii Can any ome help me to Write a programme to merge pdf iles using itext api.  Hi friend, For solving the problem visit to : http://www.roseindia.net/java/itext/ Thanks
java coding
java coding  Hi sir, WRITE A PROGRAMME TO MAKE EMPLOYMENT MANAGMENT HAVING COLORS AND FRAME IN IT,???? CAN U SUGGEST ME HOW TO MAKE IT IN CORE JAVA
Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads