Posts

Showing posts from June, 2018

19th Day @ Apex : SWING

Image
Hi Readers, In Process of developing my  project i have to also learn a new thing about swing. This is something similar to AWT.  But They have their own differences. Java Swing tutorial is a part of Java Foundation Classes (JFC) that is used to create window-based applications. It is built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in java. Unlike AWT, Java Swing provides platform-independent and lightweight components. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc. There are many differences between java awt and swing that are given below. No. Java AWT Java Swing 1) AWT components are  platform-dependent . Java swing components are  platform-independent . 2) AWT components are  heavyweight . Swing components are  lightweight . 3) AWT  doesn't support pluggable look and feel . Swing  supports pluggable look and feel . 4) AWT provi

18th Day @ Apex: AWT

Image
Hi Readers, Today I started on My simple project for that i learn About AWT i.e Abstract window toolkit. Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based applications in java. Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system. AWT is heavyweight i.e. its components are using the resources of OS. The java.awt package provides classes for AWT api such as TextField, Label, TextArea, RadioButton, CheckBox, Choice, List etc. The hierarchy of Java AWT classes are given below. Container The Container is a component in AWT that can contain another components like buttons, textfields, labels etc. The classes that extends Container class are known as container such as Frame, Dialog and Panel. Window The window is the container that have no borders and menu bars. You must use frame, dialog or another window for creating a window. Panel The Panel is the container that doesn't contai

17th Day @ Apex : Exception Handling in java

Image
Hi Readers, Today I learn about Exception Handling in java The Exception Handling in Java is one of the powerful mechanism to handle the runtime errors so that normal flow of the application can be maintained. The java.lang.Throwable class is the root class of Java Exception hierarchy which is inherited by two subclasses: Exception and Error. A hierarchy of Java Exception classes are given below: There are mainly two types of exceptions: checked and unchecked. Here, an error is considered as the unchecked exception. According to Oracle, there are three types of exceptions: Checked Exception Unchecked Exception Error

16th Day @ Apex : Encapsulation

Image
Hi Readers, Today I learn about an interesting thing about Java, which is encapsulation. Encapsulation in Java Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule which is mixed of several medicines. encapsulation in java We can create a fully encapsulated class in Java by making all the data members of the class private. Now we can use setter and getter methods to set and get the data in it. The Java Bean class is the example of a fully encapsulated class. Advantage of Encapsulation in Java By providing only a setter or getter method, you can make the class read-only or write-only. In other words, you can skip the getter or setter methods. It provides you the control over the data. Suppose you want to set the value of id which should be greater than 100 only, you can write the logic inside the setter method. You can write the logic not to store the negative numbers in the setter methods. It is a way to ac

15th Day @ Apex. Java Abstraction

Image
Hi Readers, Today I learn about Abstraction in java. Abstract class in Java A class which is declared with the abstract keyword is known as an abstract class in Java. It can have abstract and non-abstract methods (method with the body). Before learning the Java abstract class, let's understand the abstraction in Java first. Abstraction in Java Abstraction is a process of hiding the implementation details and showing only functionality to the user. Another way, it shows only essential things to the user and hides the internal details, for example, sending SMS where you type the text and send the message. You don't know the internal processing about the message delivery. Abstraction lets you focus on what the object does instead of how it does it. Ways to achieve Abstraction There are two ways to achieve abstraction in java Abstract class (0 to 100%) Interface (100%)

10th Day @ Noida: Stack and Heap

Hi Readers! I have come to know about heap and stack today which was amazing. Heap and Stack Memory in Java Program What is Stack Memory? Stack in java is a section of memory which contains methods, local variables, and reference variables. Stack memory is always referenced in Last-In-First-Out order. Local variables are created in the stack. What is Heap Memory? Heap is a section of memory which contains Objects and may also contain reference variables. Instance variables are created in the heap. Memory Allocation in Java The JVM divided the memory into following sections. Heap Stack Code Static This division of memory is required for its effective management. The code section contains your bytecode. The Stack section of memory contains methods, local variables, and reference variables. The Heap section contains Objects (may also contain reference variables). The Static section contains Static data/methods.

9th Day @ Noida: Access Modifier

Image
Hi Readers! I have learnt today about access modifier in Java. Access Modifiers in Java As the name suggests access modifiers in Java helps to restrict the scope of a class, constructor, variable, method or data member. There are four types of access modifiers available in Java: Default – No keyword required Private Protected Public Default: When no access modifier is specified for a class, method or data member – It is said to be having the default access modifier by default. Private: The private access modifier is specified using the keyword private. The methods or data members declared as private are accessible only within the class in which they are declared. Any other class of the same package will not be able to access these members. Top level Classes or interface cannot be declared as private because private means “only visible within the enclosing class”. protected means “only visible within the enclosing class and any subclasses” Hen

8th Day @ Apex: Constructors

Image
Hi Readers! I will share the concept of Constructor in Java today which I have learnt today. Constructors in Java: Constructors are used to initializing the object’s state. Like methods, a constructor also contains a collection of statements(i.e. instructions) that are executed at the time of Object creation. When is a Constructor called? Each time an object is created using new() keyword at least one constructor (it could be default constructor) is invoked to assign initial values to the data members of the same class. There is two type of constructor in Java: No-argument constructor: A constructor that has no parameter is known as default constructor. If we don’t define a constructor in a class, the compiler creates a default constructor(with no arguments) for the class. And if we write a constructor with arguments or no-argument then the compiler does not create a default constructor. Default constructor provides the default values to the object like 0, null etc. de

7th Day @ Noida: Aware of JVM

Hi Readers! Today I have learnt about JVM in Java. What is JVM? A specification where the working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Oracle and other companies. An implementation Its implementation is known as JRE (Java Runtime Environment). Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created. What it does? The JVM performs the following operation: Loads code Verifies code Executes code Provides runtime environment JVM provides definitions for the: Memory area Class file format Register set Garbage-collected heap Fatal error reporting etc.

6th Day @ Noida: Overloading

Image
Hi Readers! I have come to know how we overload the functions in Java. I will share the concept of that. Overloading in Java Overloading allows different methods to have the same name, but different signatures where a signature can differ by a number of input parameters or type of input parameters or both. Overloading is related to compile time (or static) polymorphism. Method Overloading is a feature that allows a class to have more than one method having the same name, if their argument lists are different. It is similar to constructor overloading in Java, that allows a class to have more than one constructor having different argument lists. let’s get back to the point, when I say argument list it means the parameters that a method has: For example the argument list of a method add(int a, int b) having two parameters is different from the argument list of the method add(int a, int b, int c) having three parameters.

5th Day @ Apex: Changing the type

Image
Hi Readers! There was a rough day in Noida but I am glad because learning type casting in Java is awesome. I would like to share my thoughts on the typecasting with you guys. Basically, The process of conversion of data type on into another is known as Typecasting.

4th Day @ Noida: Static and non- static

Image
Hi Readers! I came to know today about one of the best parts of Java. I mean the joyful learning with static and non-static concept in java. There is three type of variable in java. Local variable Global varible also known as static variable non-static variable. Local Variable: The variables which are declared inside a function in a Java program and its scope is up to that function only. Non-Static Variable: This type of variables is known as object variables because these variables are generated with every object of that class. It is also known as an instance variable. Static variable: This type of variables is called a class variable and it is generated only once for a particular class. Moreover, we can use a static variable to serve all the functions inside the class for all objects.

3rd Day at Noida: Got aware of some amazing packages

Image
Hi Readers! I wanted to know actually what a package is! and the day was on Apex for that. So I have learnt about some package and they are crucially used in our general java programs. What is package in java?  Formally, a package in Java is a mechanism to encapsulate the sub packages, classes and interfaces. Why packaged is used? Packages are used for  For preventing naming conflicts Providing controlled access There are two types of package are available: inbuilt package user-defined package some common packages are mentioned below: java.lang package java.io package java.util package and many more....

Second day At Noida: Learning some crucial concepts of java

Image
Hello Readers! Today was my another day in Apex Pvt Ltd. I have explored today some basic commands in java as " JavaP "  I have also learnt how we can view all the functions of a class so that we come to know how we will use another class with the shown function of an existing class. I have mentioned some examples of JavaP command in cmd prompt: Follow the instruction if you want to use javap cmd: First of all, compile your java file using javac. then write javap followed by your class name. you will get the functions used in that class.  check out the picture mentioned below: For using this cmd, we will be familiar with the functions of a class without opening that.

A Day in Noida: Learning Begins

Image
Today was my first day in Apex Pvt Ltd and I have learnt the basic elements of Java. These elements are given below: 1. What are the uses of println() and printf? Ans: println( )  prints a new blank line and then your message.  printf() provides string formatting similar to the printf function in C .  printf() is primarily needed when you need to print big strings to avoid string concatenation in println() which can be confusing at times (Although both can be used in almost all cases). Eg. int a = 10;int b = 20;  println("a: " + a + " b: " + b);      //Tedious String Concatenation printf("a: %d b: %d\n", a, b);     // Output using string formatting.  While printf() enables you to print fractional outputs up to any decimal place in a single line, the same task using println() can get very complex. 2. What is the use of Java? Ans: Java is a programming language that developers use to create applications on your computer. Chance