CORE JAVA get middle name

Ads

 
 

Share on Google+Share on Google+

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

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

Ads
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 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... 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
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
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
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      
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
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
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
Get Local Host Name
Get Local Host Name     ... you in understanding a code how to 'Get Local Host Name'. For this we have.... The System.outprintln print the interface name by calling the get Display 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
Java example program to get the operating system name of the system
Java example program to get the operating system name of the system       java get Operating... the information about the current operating system name. We can get the current
Java class name and file name are different
Java class name and file name are different  Can we run a Java program having class name and file name different?   Hi Friend, No, you can't. It is necessary to save the java file with its class name otherwise
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
core java - Java Beginners
core java  i want to get java projects in core java
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

Ads

 
Advertisement null

Ads