Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners CORE JAVA get middle name

Have Programming Question? Ask it here!
 
 
 


Ankit Kumar
CORE JAVA get middle name
1 Answer(s)      2 years and a month ago
Posted in : Java Beginners


hello sir...how to get middle name using string tokenizer....??? eg..like name ANKIT it will select only K...!!!!


Advertisement
View Answers

June 14, 2012 at 1:28 PM


The given code accepts the name from the console and find the middle character from the name.

import java.util.*;

class GetMiddleCharacter
{
    public static void main(String[] args) 
    {
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Name: ");
        String str=input.nextLine();
        int len=str.length();
        int c=len/2;
        char ch[]=str.toCharArray();
        System.out.println("Middle Character is: "+ch[c]);
    }
}


Related Tutorials/Questions & Answers:
CORE JAVA get middle name
CORE JAVA get middle name  hello sir...how to get middle name using string tokenizer....??? eg..like name ANKIT it will select only K...!!!!   The given code accepts the name from the console and find the middle
Java get middle character
Java get middle character In this tutorial, you will learn how to get middle character from the word. Here is an example of getting the middle letter of the word entered by the user using Java. If you have a word string 'company
Advertisements
Get computer name in java
Get computer name in java       We can get the computer name by the java code program. For getting computer name we have used java.net.InetAddress class. We will use static
Java file get name
Java file get name In this section, you will learn how to get the name... get the name of any file. Output: File name is: out.txt... the name of the file. Here is the code: import java.io.*; public class
Java Get Host Name
Java Get Host Name       In this Example you will learn how to get host name in Java. Go through...; Java code to get host name import java.net.
Java example to get Object class name at runtime
Java example to get Object class name at runtime       java get Object class name In java there is a way that makes us enabled to get the object class name at runtime. It can
Java Get File Name
Java Get File Name       In this section, you will study how to obtain the name of file.  In order to get the file name, we have provided the path of file 'Hello.txt
How to get month name from date(like-25/06/2012) using java?
How to get month name from date(like-25/06/2012) using java?  How to get month name from date(like-25/06/2012) using java
Java program to get domain name by URL
Java program to get domain name by URL       We can also get the domain name by the java... of numerical internet address.  In our this example to get the domain name we
core java
core java  hello sir....i have one table in which i have 3 columns First Name,Middle Name,Last Name...............but i have to show single name... Name-Ranvir Middle Name-Kumar Last Name-Kapoor i have to print Ranvir Kumar
CORE JAVA
CORE JAVA  Q)How to sort a Hash Table, if you pass an Employee Class Object in that First Name, Last Name, Middle Name based on last name how you sorting the Employee Class? Q)How to display the list variables in reverse
core java
core java  its compulsory to save file name and class name is same in java
core java - Java Beginners
core java  i want to get java projects in core java
Java program to get class name without package
Java program to get class name without package ... example which describes you that how you can get the class name without package.... As a result we will finally get the class name without package.  In this code
core java
core java  In java primitive variables will get its default value automatically after declaration. Then why it is mandatory to initialize a variable before using
core java
core java  how to display characters stored in array in core java
core java
core java  basic java interview question
CORE JAVA
CORE JAVA  CORE JAVA PPT NEED WITH SOURCE CODE EXPLANATION CAN U ??   Core Java Tutorials
core java
core java  i need core java material   Hello Friend, Please visit the following link: Core Java Thanks
Get Property by Name
to get Property by Name. For this we have a class name "Get Property... .style1 { margin-right: 75px; } Get Property by Name      
core java
core java  Hi, can any one expain me serialization,Deseralization and exterenalization in core java
core java
core java  Hi, can any one exain me the concept of static and dynamic loading in core java
Core JAva
Core JAva  how to swap 2 variables without temp in java
core java
core java  how can we justify java technology is robust
SQL get Column Name
SQL get Column Name       SQL get Column Name is used to return the Fieldnames of the table... get Column Name'. To understand and elaborate example we create a table 'stu
CORE JAVA
CORE JAVA  What is Garbage collection in java? What is the role of a developer for garbage collection
Core Java
Core Java  How to execute cmd command through java?? Give Code of them
core java
core java  write a java program to view product details from product table
core java
core java  java program using transient variable   Hi... TransientVariable{ String name; transient String pass; public TransientVariable(String...() { return "Name=" + name + "\n Password=" + pass; } public static void main(String
Core Java
Core Java  Hi, Can any one please share the code for Binary search in java without using builtin function
Core Java
Core Java  Please write a Java Program to design login form and store the values in file & validate and display the MainForm
core java
core java  Hello sir,What is logic behinde the core java programms,How may programmas are there,for example,sorting of two numbers,grade of the student details,fibonice serice,paldroma,incremting of the program,asscedding
core java
core java  Hello sir,What is logic behinde the core java programms,How may programmas are there,for example,sorting of two numbers,grade of the student details,fibonice serice,paldroma,incremting of the program,asscedding
Get Month Name Example
Get Month Name Example     ... in understanding a how to get a 'Get Month Name Example'.For this we have a class name 'GetMonthNameExample'. Inside the main method we declared a String array name
Core Java
Core Java  Hi, Can any one please expain me why derived data types are required in java as we have primitive data types with us
Core Java
Core Java  Hi, Can any one please expain me why derived data types are required in java as we have primitive data types with us
Core Java
Core Java  Hi, can any one please tell me the uses of return type,"Super" and "this" calling statement in Java?? why do we required this,super calling statement?? why return type is required
Core Java
Core Java  How to load class dynamically in java ?   To load class dynamically you can use Class class method Class.forName("abc.xyz.MyClass"); This method load the given class at run time
Core Java
Core Java  what is a class
Core Java
Core Java   How can i write own compile time and runtime exceptions in java   Hello Friend, Please visit the following links: http://www.roseindia.net/java/exceptions/how-to-throw-exceptions.shtml http
core java
core java  Dear Friends, I am new to java and i faced one program.Can... a b c d a b c d e a b c d e f a b c d e a b c d a b c a b a how can we get... new to java and i faced one program.Can any one just help me getting output
Core Java
Core Java  Is Java supports Multiple Inheritance? Then How ?   Hi Friend, Java does not support multiple inheritance but it can be achieved by using the interface. In Java, Multiple Inheritance can be achieved through
Core java
Core java  How to use hyperlink that is href tag in core java without swing, frames etc. My code is StringBuffer oBodyStringBuffer = new StringBuffer("Message Classification: Restricted.\n\n
CORE JAVA
CORE JAVA  What is called Aggregation and Composition
core java
core java  surch the word in the given file
Core Java
Core Java   Hi, Can any one please tell me the program to print the below matrix in a spiral order. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Thanks a lat in advance
core java
core java  I am having 10 countries in the data base as back end.in front end i am having a button in web page like SHOWCOUNTRIESLIST so i need java code how to retrive that 10 countries from back end to my page,,pls help me
Core Java
Core Java  Q. A producer thread is continuously producing integers... by the producer, the method "get( )" is invoked by through the "Consumer" class which... val; boolean value = false; synchronized int get() { if(!value) try { wait
core java
core java  how to write or update into excel file using...; Please visit the following links: http://www.roseindia.net/tutorial/java/poi/insertIntoExcelFileData.html http://www.roseindia.net/answers/viewqa/Java
 

 

 

DMCA.com