Classes and Objects in Java with examples

A class is a blueprint or model based on which object is defined. A class cannot exists in real world but object can. A class is a physical idea where as object is an instance of the class.

An object is an entity that is having state and behavior or simply we can say object is anything that exists in the real world. An object will have properties and actions. Properties are represented by variables and Actions are represented by methods.

java objects containing variables and methods
Objects in Java
  • If you take a dog it will have properties like name, height, weight, age and actions like barking, running, biting etc.
  • We can't create a object without a class.
  • However we can create a class without a object for example Dinosaur
  • A class is a physical idea where as object is instance of class
  • Class code is stored in method area in JVM where as
  • Objects are created in heap in JVM



Core Java Concepts

Hi folks,I would like to inform that who are working as a test enginners or going to start their career in testing or quality assurance or QA perspective be careful and you should remember things are getting changed rapidly and don't expect that you will be asked what is regression testing, what is quality assurance or what is retesting bla bla..  The trend is now getting changed and you will be asked to write the code also for any language that you are keeping in your resume. Incase of Java be prepare for Java coding, Java Naming Conventions, Java OOPS concepts like Inheritance, Polymorphism, Abstraction, Encapusulation, Exception handling, Multithreading, Swings 
JDBC or any such type of things you might be asked.

And if you are an automation experrise then you will be asked for system test also, where you need to sit and solve the given task or write code for that one.

Here is the list of Java Concepts I would like explain in detail which is useful for especially for test engineers.

1) Classes and Objects
2) Inheritance
3) Polymorphism
4) Abstraction
5) Encapsulation
6) Exceptional Handling
7) Multi threading

Index in SQL with examples

Data Storage:


  1. The data in SQL Server is stored in the form of data pages.  
  2. The size of each data page is 8kb.
  3. The data page contains the page header which is 96 bytes.
  4. The header will have previous pointer (PP), object id, next pointer (NP).
  5. The previous pointer pointing to the previous page, this value is NULL for first page.
  6. The next pointer pointing to the next page, it’s value is NULL for the last page.

Data Access:


In SQL Server Data will be accessed in two ways.

Table Scan : It starts from beginning of the table and scan each and every page for required data, it extracts the rows to meet the query criteria.

Using Index: When index is created for a table, it travels through index tree structure to determine the required rows and extracts the rows which will meets the query criteria.

User Defined Functions in SQL Server

The functions created by the user are called user defined functions.

 Types of user defined functions:

 1. Scalar Valued Functions
2. Table Valued Functions

1. Scalar Valued Functions:

The functions which return scalar (single value) to the calling environment are called scalar valued functions.

 Syntax:
create function (function_name)
(@para1 datatype(size), ……@para n datatype (size))
retrun datatype
as
begin
function body
return ( variable)
end
For executing the function
Declare @ var (datatype)
Set @var= owner.funciton_name ( para1, para2..)
print@var
Example: Write a function to find the sum of the two numbers
Create function add_sum ( @a int, @b int)
Return int
As
Begin
Declare @c int,
Set @c = @a+@b;
return(@c);
end
Executing the function
Declare @z int
Set @z= dbo.add_sum(3,5)
print@z


Aggregate and Group Functions in SQL and Oracle with examples


  • Aggregate functions will acts group of values at a time and returns a single value. It is also called Group functions.
  • Aggregate functions will ignore NULL values while calculating.
  • Here is the sample emp table using for solving examples.


emp sample table for solving examples
Emp Sample Table
1. Sum:
Sum is used to find the sum of values in a column.

Example:Write a query for find the total salary of emp table.
select sum(sal) from emp
2. Avg: Avg is used to find average values for given values.

Example:Write a query for find the average salary of emp table.

select avg(sal) from emp


Database (DB)Testing - Strategy, Concepts, Checklist with sample test cases

In software testing there will be so many types of testings we will be carried out to deliver the product as per the client needs or as per the requirements. In which database testing or db testing is the one which requires thorough knowledge on sql commands, stored procedures, functions and triggers. There will be so many database software available in the market like SQL Server, Oracle, MySQL, PostgreSQL, Hadoop (Hadoop distributed file system) etc., What ever may be the database software we are using there will be slight difference in SQL query syntax, however most of the things will be same in all software. Database testing or DB testing is a technique of validating the database in which data is getting inserted/updated/deleted in various tables on various databases. Database testing is will differ based on the type of the data you are going to verify. I mean based on the OLTP or OLAP (Online Analytical Processing) the method of database testing will differ. For OLTP (Online Transaction Processing) we are verifying the stored procedures and validating the data is inserted/deleted/modified properly or not. And for OLAP lot of scripts or DW jobs will comes into picture. Having extensive knowledge on database testing I can say database testing should be carried out manually, why because I didn't find any automation testing tool which fulfills the db tsting requirements. Whenever the project started and ready for testing initially we will get the packages, stored procedures, functions etc for QA. In the sense the Database testing concept is divided into two phases.

  1. Backend Database Testing
  2. Frontend Database Testing

Functions in SQL - Scalar - Mathematical, String, Date and Time functions

A function is a predefined programming segment specially used for specific and well defined task.

Functions in SQL Server:

     1. Scalar functions
     2. Aggregate or group functions


1. Scalar functions:

These scalar functions will take single value as input and returns a single value.
  • Mathematical Functions
  • String functions
  • Date time functions
  • System functions
  • Security functions
  • Confirmation functions
  • Cursor functions
  • System statistic functions
  • Text and image functions
We will concentrate on first three functions now.