Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Wyraz {
- String str;
- int x;
- public Wyraz(){
- this.str="";
- this.x=0;
- }
- public void dodajZnak(char letter){
- str+=letter;
- x++;
- }
- public String toString(){
- return str;
- }
- public int length(){
- return x;
- }
- public static void main(String[] args) {
- Wyraz wy= new Wyraz();
- wy.dodajZnak('a');
- System.out.println(wy.toString());
- System.out.println(wy.length());
- wy.dodajZnak('b');
- System.out.println(wy.toString());
- System.out.println(wy.length());
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement