right here.

Pagi-pagi buta Jerico berangkat ke rumah orang tuanya sebelum menuju ke sekolah karena sang Ibunda memintanya untuk datang terlebih dahulu “Engga usah wes Mi, Jeri bisa makan di kantin sekolah nanti…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Java keywords

I like to describe some important java keywords in this tutorial. Those are.

2.catch -allow to define a block of code that needs to be executed if an exception occurred. In this block, used to handle the exceptions by declaring the type of exceptions within the parameters.

3.finally-this is a block. this block will be executed without regarding the exceptions. This block used to deallocate the resources. as examples, we can 1.close the opened database connections, 2.to close the opened files, etc.

4.throws -use to declare an exception. this will inform the developer that there may be an exception and should handle it.

5.throw -use to explicitly throw an exception in a method or in a block.

Those are the access modifiers in java.

Now we should discuss about the java flow controls.

switch- this allows a variable to test for equality against a set of values.

case- each values in the switch, we call as a case.

for- use as a loop(initialization, condition, increment or decrement)

while- use as a loop (execute until condition false).

do- this a special keyword in java. we use this with the while loops. by using this the loop will execute one more time even the condition already failed. Because the statement will execute before the conditions checking.

This will show you the difference of the while loop and the do-while loop.

break- when the break condition executed in a loop, the loop will be terminated. can be used in switch statements also. if we use a break in the inner loop, only stop the inner loop and outer loop will be executed.

continue- by using the continue keyword in the loops, we can stop the current iteration and skip to the next iteration.

goto- Unless C/C++, java is not supported to the goto statement. but java support for the Label. we can specify the label with the break keyword.

if- this use to check some conditions.

else- else mean, if not that

abstract- this used to take the abstraction. use in the classes and in the methods. It cannot be used in constructors and in the variables. if a class is abstract, cannot be instantiated. we cannot use abstract keyword with the final keyword. because if we use both methods. what happen? Those keywords are completely opposite to each other. because, if we use final. we cannot override the method. but we already added the abstract. then we have to implement. that means override. so it complicated. We cannot use abstract method as private. because we need to implement this method in another class(in a subclass). Another thing is we cannot use static with the abstraction. Because we use the abstraction for taking the dynamic binding. But static methods are binding their functionalities in statically. And abstract method cannot be synchronized, because it can be harmful. because if we try to synchronize an abstract method, that's mean we are going to make a lock for the unknown implementation. so this can be a cause for a deadlock. we cannot use abstract with final, private, static, synchronized for the same method. We can use throws clause for an abstract method. we can declare an inner class as an abstract.

class- class is a template or a blueprint of the objects. when defining a class we need to think about the following order.

constructors are used to initialize the newly created object. it will set the initial state. variables are used to represent the state of the classes and objects. variables are mainly two types. one is class variables(static variables) and instance variables(non-static variables). methods represent the behaviors of the class.

const- java is not using the const keyword. because it has no function. instead of the constant, java uses the final keyword. Id does the same task.

extends- use to extend the superclass.

interface- interface is a blueprint of the classes. The variables are static final and methods are public abstract. Interfaces are used to take the total abstraction.

implements -use to implement the interfaces.

new- used to create a new instance of a class. will allocate the memory in runtime for the new object and return a reference for that reserved memory location. All objects are occupying memory in the heap area. It invokes objects constructor.

Q)Is the only way to create a new object in java? the answer is no.

static- java uses static keyword for memory management. we can use static with variables, methods, classes(nested classes), and blocks. static properties belong to the class than an instance of the class. static variables called class variables and static methods called as class methods. static variables saves memory.

super- need to refer to the superclass properties.

If there any shortcomings, you can show them. I will highly appreciate it.

Add a comment

Related posts:

Homeless Life Lessons

It was during a brutal heatwave in Vegas, 115 degrees every day for weeks. And, because it’s Vegas, it feels hotter than it should. I was walking up a sharp incline, dragging a rolling suitcase, a…

A snapshot of Amiqus x UKGovcamp 2019

Saturday 19th January saw me travel down from Edinburgh for UKGovcamp. Given the length of the journey, I wasn’t too surprised that I managed to make a few wrong turns on my way to 102 Petty France…

La Turchia del futuro

Un antico proverbio turco dice che l’uomo è saggio quanto la sua testa, non quanto la sua età. Il calcio, con pregi e difetti, ha messo in atto un insegnamento simile da molti anni ormai, seppur con…