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



Home Answers Viewqa Java-Beginners CORE JAVA get middle name
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ankit Kumar
CORE JAVA get middle name
1 Answer(s)      2 years and 6 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...!!!!


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 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. 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
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 - Java Beginners
core java  i want to get java projects in core java
core java
core java  its compulsory to save file name and class name is same in java
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
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  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
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
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  how to swap 2 variables without temp in java
core java
core java  how can we justify java technology is robust
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  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
 

 

 

DMCA.com