Software Engineer at Virtusa

Event & Graphics


  • To make a GUI, start with a window, usually a JFrame.

JFrame frame = new JFrame();

  • You can add widgets to the frame using


  • Unlike most other components, the JFrame doesn’t let you add to it directly, so you must add to the JFrame’s content pane.
  • To make the…

static is a non-access modifier in Java which is applicable for the following:

  1. blocks
  2. variables
  3. methods
  4. nested classes

To create a static member(block,variable,method,nested class), precede its declaration with the keyword static. When a member is declared static, it can be accessed before any objects of its class are created, and without reference to any object. …


No argument Constructors

As the name specifies the no argument constructors of Java does not accept any parameters instead, using these constructors the instance variables of a method will be initialized with fixed values for all objects.

Public class MyClass {
Int num;
MyClass() {
num = 100;

You would call…

Developing a Class.

  • Figure out what the class is supposed to do.
  • List the instance variables and methods.
  • Write prepcode for the methods.
  • Write test code for the methods.
  • Implement the class.
  • Test the methods.
  • Debug and reimplement as needed

Pre-increment and Post-increment

Pre-increment operator: A pre-increment operator is used to increment the value of a…

Bullet Points

  • Classes define what an object knows and what an object does.
  • Things an object knows are its instance variable.
  • Things an object does are its method.
  • Methods can use instance variables so that objects of the same type can behave differently.
  • A method can have parameters, which means you can…

Declaring a variable

  • Java cares about type., So for this type safety to work, you must declare the type of your variable.
    Variables are of two type:
    1 Primitive
    2 Object Reference

There is only these two declaration rule.
1 variables must have a type.
2 variables must have a name.

Primitive Type

Udesh Kavinda

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store