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...!!!!

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]);
    }
}

Ads









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 how to get domain name from url
java how to get domain name from url  How to get the domain name from a url string? Example program in java for "how to get domain name from url" Thanks   Hi, You can use the following example code: URL linkURL
Java Get Host Name
Java Get Host Name       In this Example you will learn how to get host name in Java... by default. Here is the video tutorial of "How to get Host Name in Java
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
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 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
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
How to get the Day name
How to get the Day name  Hi, I am a beginner in Java and new to this web world as well. have a requirement to implement in my assignment project as below: We need to add the days in input date such that it create the date
What is domain name and how to get it?
What is domain name and how to get it?  Hi, I am am searching for the information about the domain name. How to get a domain name for my company... is the unique name given to a website on a server. Example of domain name
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
how to get java path name
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
ModuleNotFoundError: No module named 'get-variable-name'
ModuleNotFoundError: No module named 'get-variable-name'  Hi, My... named 'get-variable-name' How to remove the ModuleNotFoundError: No module named 'get-variable-name' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'get-variable-name'
ModuleNotFoundError: No module named 'get-variable-name'  Hi, My... named 'get-variable-name' How to remove the ModuleNotFoundError: No module named 'get-variable-name' error? Thanks   Hi, In your
Get Class Name
Get Class Name       In the example given below we will learn how to get name of the particular class with package name. getName() method returns fully qualified name
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
sql query to get name,age,phone,address from tables t1,t2,t3,t4,t5 ..
sql query to get name,age,phone,address from tables t1,t2,t3,t4,t5 ..   this is for single table : query ="SELECT name , age , pwd , phone , address FROM t1 order by name"; this is for 2 tables : query ="SELECT t.name
ModuleNotFoundError: No module named 'middle'
ModuleNotFoundError: No module named 'middle'  Hi, My Python... 'middle' How to remove the ModuleNotFoundError: No module named 'middle'... to install padas library. You can install middle python with following command
get absolute time java
get absolute time java  How to get absolute time in java
ModuleNotFoundError: No module named 'micral-name-core'
ModuleNotFoundError: No module named 'micral-name-core'  Hi, My... named 'micral-name-core' How to remove the ModuleNotFoundError: No module named 'micral-name-core' error? Thanks   Hi, In your
java get file permission
java get file permission  How to check the get file permission in Java
Java Program MY NAME
Java Program MY NAME   Write a class that displays your first name... with the following name (for example, for letter A, public displayLetterA... in the correct order to display your name
My name, java project
My name, java project  Write a class that displays your first name vertically down the screen ?? where each letter uses up to 5 rows by 5 columns... that letter in a method with the following name (for example, for letter A, public
My name, java project
My name, java project  Write a class that displays your first name vertically down the screen ?? where each letter uses up to 5 rows by 5 columns... that letter in a method with the following name (for example, for letter A, public
Get Parameter Name From Servlet Request
having name as firstname, lastname and middle name. We can get values...Get Parameter Name From Servlet Request      ..., Last Name and Middle Name:</font></b><br><br>

Ads