Can you please help me with this simple (not for me:) issue

Why this doesnt work?
public void spl ()
     String a=("moon.sun");
String [] f=a.split(".");
System.out.println(f[0]);
}

The second expression to split() is a regular expression. A period in a regular expression matches all characters, and you're wanting it to just match a period.
To match just the period for your split, you'll need to escape it:String[] f = a.split("\\.");

Similar Messages

Maybe you are looking for

  • ISE 1.1 - switch ignores "Session-Timeout"

    hi all, I'm playing around with ISE guest service and have some difficulty with Time Profiles. After guest logs in, Radius attributes are sent to the switch (3750G) one of them is Session-Timeout which should be similar to 1h (DefaultOneHour) Accordi

  • See my Mac Mini on another Mac's desktop with firewire

    Hello, Does anyone know how to connect a Mac Mini and an Imac G5 so I can see my Mac Mini on his desktop and run the applications from my machine on his? I am hoping to work at my father-in-law's on an upcoming trip and not bring a monitor with me. I

  • Where are the regular maintenance updates?

    Most expensive/professional software I own licences for receives maintenance updates and bug fix patches on a regular basis. Even with shareware and freeware, the patches and updates just keep coming. Flash Professional should certainly be no differe

  • Is there any way I can order larger size print in other size that the 8*10 or 16*20 ?

    I believe most of us use a DSLR which have a 2/3 censor, and those 8*10 or 16*20 do not respect the size of the pictures we take... I hate to have to specific files to get prints in a reasonable size. A good print size would be a 8*12, 12*18 or 16*24

  • Communications Express doesn't create access Manager SSO session

    Hi all, I'm running Communications Express, Sun Access Manager and Sun messaging server, each on seperate hosts. Single Sign On works i.e. when users have a valid session and point their browser at the Communications Express URL they can access their