Hello guys...
I want to share you what we actually did in our first week on Bootcamp lately. For you who know about coding on Java, you may know that we should know the basic, right?
Yes! On week 1, we learned the basics on Java with our trainer. It was REALLY REALLY the basic. So, if you want to join this program but you are not from IT major, just don't worry. They were open for all majors. We really learned about coding form the basic. For the first, we started from the logic. What is coding, how to connecting our logic to computer's logic. In this program, we also try so many exercises that could improve our skills.
Of course, for the first meeting we will start from the easy one, but step by step, it will more difficult. From our trainer, we learned something that if you wanna be a programmer, you should have a "BAKUL" mental and do it frequently. BAKUL is BAca, Ketik, ULangi (in Bahasa). 'Cause if you always repeat and understand more and more about the basic, you will be an expert. Sometimes, we also have to exercise about a program and repeat it at least 7 times. Even your finger feels like broken, you will find its fun and of course would help you more for your skills.
For now, I also want to give you a short review that important to know about the basics we learned lately. Let's just jump for it!
For the first, it's about basic syntax on Java, they are :
1) Case Sensitivity. Java program is so sensitive with kind of case of letter. The identifier "Indah" and "indah" is different for Java.
2) Class Names. The first letter of class name should start with upper case letter. If class name have several words, each inner word's first letter should use upper case letter.
3) Method Names. Method name should start with lower case letter. Same with class name if it has two or more words, each inner word's first letter should use upper case letter, too.
4) Program File Name. It should exactly same with class name.
5) Public static void main(String args[]). A mandatory part that should be used in every Java program.
The next basic we should know is the meaning of object, class, method, constructors, identifier and variable/property.
1) Object, simply can be describe as the real shape of the class. Object have state and behavior. State is the identity/atribute of the object (ex state for human : name, id, address, age) and behavior is such as eating, sleeping, some kind of activity we want to do in the program.
2) Class, can be defined as a blueprint of the object that describe the state/behavior of the object.
3) Method, basically is a behavior. Method is part of a class, so we should write method in the body of the class. A class can have many methods. Method itself has syntax methodName() or have { }. Method have 2 types, they are method return value and method unreturn value. The different of these methods is method return value have data type (ex : int, String, parameters) and method unreturn value doesn't have those parameters (ex : void/empty).
4) Constructors, basically has the same name as its class and is syntactically similiar to a method. However, constructors have no explicit return type. For each class, at least have a constructor. If we don't write the code on our program, the program itself will make the default constructor.
So, we can conclude that constructors :
- Method name = class name
- Doesn't have data type, similiar to class
- Called by instantiation process.
- Must be used "public"
Through instantiation process, we could make an object by using the class.
Example :
Scanner nilai = new Scanner(System.in)
where :
- Scanner : class name
- nilai : object
- new : instantiation function
- Scanner(System.in) = constructor
5) Identifier, the name for class, method, and variable.
6) Variable/property, it provides us a storage that can be manipulated by our program.
6) Variable/property, it provides us a storage that can be manipulated by our program.
For more explanation, you can find it on here. Happy exploring!
Now, I want to show you how to make your first java program.
By used code above, we will have result :
Easy, right?
Okay. Maybe just it is I can share to you. For the next part, I will show you more what we learned. Of course with the different level. Thank you for reading ^^
Komentar
Posting Komentar