Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4534866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:20:03+00:00 2026-05-21T14:20:03+00:00

HI Everyone. I’m sorry for this embarrassingly newbie question but I cannot seem to

  • 0

HI Everyone. I’m sorry for this embarrassingly newbie question but I cannot seem to figure out the command to do it. I’m okay with python and had a script in jython that I’m convering to pure java(and learning along the way).

I have a string: Java is really cool

I know how to strip the string to get the final result: really cool

but i’m not sure the command to do it in java. I found commands in java to do it specifically by text but I want to use a space as a deliminator and get the words.

Can someone tell me what java command to use? I would want to be able either remove the first two words and/or specifically select the words I want.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:20:03+00:00Added an answer on May 21, 2026 at 2:20 pm

    I think you are looking for String.split.

    String s = "Java is really cool";
    String words[] = s.split(" ");
    String firstTwo = words[0] + "  " + words[1]; // first two words
    String lastTwo = words[words.length - 2] + " "
            + words[words.length - 1]; // last two words
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. I'm just starting with django, so sorry for a possibly stupid question. Imagine,
everyone, I made a shooting game just like 1942(classic shooting game),but here's the question,
everyone. This is a piece of code from using sqlite in android tutorial: return
everyone! new to here and been pondering about this myself for some times with
Everyone on this site has been very helpful on my schooling of iOS programming,
everyone, i found this strange problem ( maybe it is a feature ) this
everyone. I have a string like this String message = This is the new
everyone.I wanna include javascript in the html(webpy templates),but it doesn't work.the javascript code in
everyone, I have this piece of the code: void foo(int var, int var1) {
everyone! I've been at this for a while, and I'm not sure how this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.