Posts

Showing posts from August, 2025

this keyword

  There can be a lot of usage of   Java this keyword . In Java, this is a   reference variable   that refers to the current object. Usage of Java this keyword Here is given the 6 usage of java this keyword. this can be used to refer current class instance variable. this can be used to invoke current class method (implicitly) this() can be used to invoke current class constructor. this can be passed as an argument in the method call. this can be passed as argument in the constructor call. this can be used to return the current class instance from the method . 1) this: to refer current class instance variable The this keyword can be used to refer current class instance variable. If there is ambiguity between the instance variables and parameters, this keyword resolves the problem of ambiguity. class  Student{   int  rollno;   String name;   float  fee;   Student( int  rollno,String name, float  ...

Java AWT

  Java AWT Java AWT  (Abstract Window Toolkit) is  an API to develop Graphical User Interface (GUI) or windows-based applications  in Java. Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system. AWT is heavy weight i.e. its components are using the resources of underlying operating system (OS). The java.awt package provides classes for AWT API such as T extField , Label ,   RadioButton, CheckBox etc. The AWT tutorial will help the user to understand Java GUI programming in simple and easy steps. Components All the elements like the button, text fields, scroll bars, etc. are called components. In Java AWT, there are classes for each component as shown in above diagram. In order to place every component in a particular position on a screen, we need to add them to a container. Container The Container is a component in AWT that can contain another components lik...