Java - Write code to get Class Name From

Requirements

Write code to get Class Name From

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String qualified = "abc.book2s.com";
        System.out.println(getClassNameFrom(qualified));
    }/*  w w  w .j a  v a  2s.c o  m*/

    public static String getClassNameFrom(String qualified) {
        String name = qualified.replaceAll(".+?\\W", "");
        return name;
    }
}