Computer Science, asked by Amaankhan9795, 1 year ago

write a program in Java to take input name of the person and print the surname first and then name

Answers

Answered by maharaj123
0
it's just a simple program
Answered by ananya071
0
public class prog { public static void main(String s) { s=s.trim();s=s+" ";String w="", ns=""; for(int i=0;i<=s.length();i++) { char ch=s.charAt(i); if(ch==" ") w=w+ch; else { if(i==s.length()-1) ns=w+" "+ns; else ns=ns+w+" "; } } System.out.println(ns); } }
Similar questions