Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Benneth Paredis
4,597 Pointsplease help me with this excercise
what am i wrong ..... please explain
public class Tweet {
private String mText;
private static final MAX_LETTERS;
public Tweet(String text) {
while (text < 140) {
String text = console.readline ("Enter your tweet here: ");
mText = text;
}
}
public String getText() {
return mText;
}
}
1 Answer

akin
Courses Plus Student 2,865 PointsHi Benneth ;
If you use constructor method for your class, don't use loop statements inside it. Constructor methods are used for initializing objects with some special values (prepare objects with initial values) etc... If you want to get messages from users, you can use another method for this (not constructor method if you want to use this method repeatedly. But in your code example , if entered text (text is also string not integer) parameter is smaller than 140, console.readline method is called repeatedly. If you want to control message length , you can use string length method. If text length more than 140, then another message can be sended to user or whatever if you want... Don't use constructor method parameters for this logical step, because of constructor method is only one time called when you create a new object
Benneth Paredis
4,597 PointsBenneth Paredis
4,597 Pointsthanks , this really helped !