Jump to content

Java coding


Go to solution Solved by Guest,

5 posts in this topic

Recommended Posts

Posted (edited)

Hello gang, I want to code in java a program that reads words and tells me how much did I input into them. However, I don't have a clue except using the input scanner to help me do it. What can or is possible to detect words

Updated by Nyanta
Posted

Hello gang, I want to code in java a program that reads words and tells me how much did I input into them. However, I don't have a clue except using the input scanner to help me do it. What can or is possible to detect words

import java.util.*;

public class Input{
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);

SOP("input: ");

String input = keyboard.nextLine(); //thats your input
}
}

I hate java its so ugly

  • Solution
Posted

Hello gang, I want to code in java a program that reads words and tells me how much did I input into them. However, I don't have a clue except using the input scanner to help me do it. What can or is possible to detect words

wait no I'm so sick I f**ked up

 

just use .split method

 

String words[] = input.split(" ");

SOP(words.length + " words");
Posted (edited)

wait no I'm so sick I f**ked up

 

just use .split method

 

String words[] = input.split(" ");

SOP(words.length + " words");

Thnx Bae <3 hope you get well soon tumblr_nxw98wylYH1tb7a4bo1_500.gif don't forget to drink lots of soup

Updated by Nyanta

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines