We've got a lot of code for the person class now. We probably want to put it in
BlueJ. And make sure that we haven't made any mistakes. So for BlueJ, I'll
create a new project, and I'll call it Friends. I need to make a class for the
person and then put my code into the class. I'll add the instance variables.
The add friend method. And let's just check that it's compiling so far. So far
so good. We'll add the unfriend method. Check that it's still compiling. Now
I'll go back and put in the constructor. So far so good. Now I should be able
to make a person object. And I should be able to add a friend. It's hard to
tell whether anything happened yet or not. Maybe we haven't finished yet.
Clearly, there's still more to do.
Ya tenemos mucho código para la clase «Person» Probablemente queramos ponerlo en
BlueJ. Y asegúrense de que no hayamos cometido ningún error. Entonces desde BlueJ, voy a
crear un nuevo proyecto y lo llamaré amigos. Tengo que hacer una clase para la
persona y luego poner mi código en la clase. Añadiré las variables de instancia
El método «addFriend». Y revisemos que está compilando hasta el momento. Hasta ahora,
todo bien. Vamos a añadir el método «unFriend». Comprueben que sigue compilando. Ahora
regresaré y pondré el constructor. Hasta ahora, todo bien. Ahora yo debería poder
crear un objeto «Person». Y debería poder añadir un amigo. Es complicado
darse cuenta si pasó algo o no. Tal vez todavía no acabamos.
Es evidente que aún hay más por hacer.
Nous avons beaucoup de code
pour la classe person.
Il faudrait le mettre dans BlueJ
et s'assurer que nous
n'avons pas fait d'erreur.
Donc pour BlueJ, je vais créer un nouveau
projet et je l'appellerai Friends.
Je dois créer une classe pour la personne
et ensuite mettre mon code dans la classe.
Je vais ajouter les variables d'instance
la méthode addFriend
et vérifions s'il compile jusqu'à présent.
Jusqu'ici tout va bien.
Nous allons ajouter la méthode unfriend,
vérifions s'il compile toujours.
Maintenant, je retourne
et ajoute le constructeur.
Jusqu'ici tout va bien.
Maintenant je devrais pouvoir
faire un objet personne
et je devrais pouvoir ajouter un ami.
Il est difficile de savoir si
quelque chose s'est passé.
Peut-être que nous
n'avons pas encore fini.
Clairement, il y a encore
des choses à faire.
Peronクラスにたくさんのコードが入りました
BlueJで見てみましょう
誤りがないか確認してください
BlueJでプロジェクトを新規作成しfriendsとし
Personに新たなクラスを生成します
その中にコードを入れます
そしてインスタンス変数を加え
friendsメソッドも加えます
コンパイルしてチェックします ここまで順調です
unfriendメソッドを加えます
コンパイルしているかチェックして
コンストラクタへ戻ります うまく行っていますね
Personオブジェクトが生成できるはずです
友人も追加できると思います
これで完成したかは不明ですが
他にもやることはあります
Person 클래스에 많은 코드가 있습니다. Bluej에서 실행해 봅시다.
그리고 실수가 없는지 살펴봅시다. Bluej에서
새로운 프로젝트를 만들어 봅시다. 저는 이 프로젝트의 이름을 Friends라고 하겠습니다. person
클래스를 만들고 저의 코드를 그 클래스 안에 넣어야 합니다. 그 후에 인스턴스 변수들,
addFriend 메소드를 추가하고 지금까지 작성한 코드가 잘 컴파일 되는지 검사해보겠습니다.
지금까지는 괜찮습니다. 이제 unFriend 메소드를 추가하겠습니다. 컴파일 되는지 확인합니다.
저는 뒤로 가서 생성자를 넣겠습니다. 좋습니다. 이제
person 객체를 만들 수 있게 되었습니다. 그래서 친구를 추가할 수 있게 되었습니다.
지금 상황이 어떨지 잘 모를 겁니다. 아마도 아직 완성도지 않아서일 겁니다.
더 해 봅시다.
We hebben nu veel code
voor de klasse persoon.
We willen het waarschijnlijk
in BlueJ zetten
en ervoor zorgen dat we
geen fouten hebben gemaakt.
Dus ik zal voor BlueJ een nieuw project
aanmaken en het Friends noemen.
Ik moet een klasse voor de persoon maken
en vervolgens mijn code
in de klasse zetten.
Ik zal de instantievariabelen toevoegen,
de methode addFriend.
En laten we controleren of
het tot nu toe compileert.
Tot nu alles goed.
We voegen de unfriend-methode toe,
controleren of het nog steeds compileert.
Nu ga ik terug en voeg de constructor toe.
Tot zover alles goed.
Nu zou ik een object persoon
moeten kunnen maken
en ik zou een vriend moeten
kunnen toevoegen.
Het is moeilijk om te zeggen
of er iets gebeurd is.
Misschien zijn we nog niet klaar.
Het is duidelijk dat er
nog meer te doen is.
Hiện giờ, chúng ta đã viết rất nhiều code cho class person rồi. Có lẽ ta sẽ cho nó chạy trong BlueJ.
Và hãy chắc chắn rằng ta không phạm phải bất kì sai lầm nào. Cho nên trong BlueJ,
mình sẽ tạo ra một project mới, và mình gọi nó là Friends. Mình cần tạo ra một class cho person
và hãy đặt code vào class này.
Mình sẽ add thêm instance variables.
Và method addFriend.
Và hãy kiểm tra xem nó đang biên dịch từ trước tới giờ hay ko. Phải nói là chạy
rất ổn. Ta sẽ add thêm method unfriend.
Check xem nó có đang biên dịch hay ko.
Giờ mình sẽ trở lại và đặt vào một constructor. Chạy ngon lành nhỉ.
Giờ mình sẽ tạo ra
một object person.
Và mình sẽ add thêm một friend.
Thật khó để nói rằng
sẽ có thứ gì xảy ra hay không. Có lẽ ta vẫn chưa làm xong.
Rõ ràng là, vẫn còn vài thứ cần làm.