Programming Shortcut - c, c++, java, SQL, online tutorials
No Result
View All Result
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us
No Result
View All Result
Programming Shortcut - c, c++, java, SQL, online tutorials
No Result
View All Result
Home Programs in java

Short name by java program

admin by admin
November 13, 2022
Reading Time:2min read
0

RELATED POSTS

Program to find out code of grade and percentage calculator in Java

Java program to find quotient and remainder

Java program to solve mathematical expressions

Hello Friends, Welcome to my blogToday will write a program to the short name by java program, this problem is also asking in many ways they are following:
1. Java Program to Convert a Person Name in Abbreviated.
2. wap to print the short name of the user.
3. Java program to convert full name to short name.
4. Java program to a short name.
5. Abbreviation of Java programming language.Problem:-
Enter Name: Anant Deep Vishwakarma
Output: A. D. VishwakarmaSolutions:-
1. Store Name in a name String.
2. Split Name String and Store to a temp string array.
3. Find temp string array length store value in other variables.
4. Take a loop to store all value to expect the last name and print the first character by value with
dot or abbreviation.
5. then print the last value of temp string all Character

Explain:
For example a store name ‘Anant Deep Vishwakarma’in a name string and then split value into temp string array as temp[0]=’Anant’, temp[1]=’Deep’ and temp[2]=’Vishwakarma’, after that count length of temp string array and use loop to left the last index value last name ‘Vishwakarma’, in loop print first char of every index value within loop. in the last print last index of program

Best java program example:

    import java.util.*;
class SName
{
public static void main(String[] args)
{
String n;
Scanner c=new Scanner(System.in);
System.out.print(“Enter the user name:”);
n=c.nextLine();
String [] t=n.split(” “);
int l=t.length;
System.out.print(“Your Short name:”);
for(int i=0;i<l-1;i++)
{
System.out.print(t[i].charAt(0)+”.”);
}
System.out.print(t[l-1]);
}
}

I hope you understand the program is any queries please comment below your query I reply to your questions soon.
Bye…

Happy coding

ShareTweetPin
admin

admin

Related Posts

Program to find out code of grade and percentage calculator in Java
Programming Language

Program to find out code of grade and percentage calculator in Java

April 5, 2022
Programs in java

Java program to find quotient and remainder

April 21, 2020
Programs in java

Java program to solve mathematical expressions

April 21, 2020
Programming Language

Difference and similarities between java and c++

April 3, 2022
.Net

Difference between FOPs and OOPs

April 16, 2020
Programming Language

How to set path in java in windows 10, 8.1, 8, 7

April 16, 2020
Next Post

Java program to convert decimal to binary with explanation

Program to check a letter is vowel or consonant in java

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Popular Stories

  • Short name by java program

    0 shares
    Share 0 Tweet 0
  • Relation of two numbers in c programming

    0 shares
    Share 0 Tweet 0
  • Bigger and smaller number in c programming

    0 shares
    Share 0 Tweet 0
  • Bigger and smaller number in c++

    0 shares
    Share 0 Tweet 0
  • Java program to perform sum of digits until single digit is obtained

    0 shares
    Share 0 Tweet 0
ADVERTISEMENT
C, C++ & Java Programming tutorial with example Programming Shortcut

Hi Friends, Programming Shortcut is Educational Blog, that From you Learn Programming in Multiple languages like C, C++, Java Programming Language.

LEARN MORE »

Recent Posts

  • Armstrong number in c
  • Program to find out code of grade and percentage calculator in Java
  • Program to find out the grade and percentage calculator in cpp

Categories

  • .Net
  • Programming Language
  • Programs in c
  • Programs in cpp
  • Programs in java
  • Uncategorized

All © 2021 Programming Shortcut - Present By Math Training.

No Result
View All Result
  • Home
  • About us
  • Programs in c
  • Programs in cpp
  • Programs in java
  • .Net
  • Privacy Policy
  • Contact Us

All © 2021 Programming Shortcut - Present By Math Training.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.