Can anyone help me with this java string code please?

  • #1
anyonebutangel
40
5
Homework Statement:
I want to write a program in java that takes a sentence as an input and displays each word separately in a new line .I came up with this .But the compiler is displaying an error and i can't make out where i made a mistake.
Relevant Equations:
no idea what equations
it's written in Java and compiled with JDK1.5
here the class name is test153 sent is the sentence entered l is the length of the sentence w is the variable storing each word temporarily before printing.
 

Attachments

  • IMG-20200904-WA0048.jpg
    IMG-20200904-WA0048.jpg
    50.5 KB · Views: 77

Answers and Replies

  • #2
14,291
8,331
Look for a hello world example in java and you’ll see they use a static main method To contain their code.

Basically you need to place your code in a static main method.
 
  • #3
anyonebutangel
40
5
Look for a hello world example in java and you’ll see they use a static main method To contain their code.

Basically you need to place your code in a static main method.
yeah.done thanks for help.
 

Suggested for: Can anyone help me with this java string code please?

Replies
20
Views
2K
  • Last Post
Replies
12
Views
818
  • Last Post
Replies
5
Views
1K
  • Last Post
Replies
1
Views
502
Replies
3
Views
745
Replies
13
Views
687
Replies
12
Views
907
  • Last Post
Replies
4
Views
499
Top