Catch us on

Sunday, July 15, 2018

Docker

Hey Guys I am back after a long long time, and this time I will try to teach you something new and its "Docker". So lets begin hope you like it.

What is Docker ???

Docker also know as container is a tool that helps to remove the overhead of Virtual machines that i will try to explain using some diagrams.

Virtual Machine(VMs)

Virtual machines as the name suggests are virtual desktop which are used to create executable environments for different application so that they could be easily executed. However different applications require different types of environment, so it would be overhead for a machine to create several VMs on a system for different applications. Due to following drawbacks:

  • Dedicated memory needs to be allocated VMs before provisioning.
  • This memory cannot be altered after provisioning of VM.
  • In general none of the application utilise the fullest of the memory. Hence,  there is a wastage of memory.
  • This is where DOCKER  comes in significance.
Docker containerises the application so that it can run.

The diagram below shows the difference between architecture of a VM and Docker.

Hope you all will like this article you can show your interest by Sharing and liking this article.

Please Share


Monday, May 2, 2016

Golden words by Malala Yousafzai

There are many problems but I think there is a solution; it's just one, and it's education..

So keep learning 

Please Share


Friday, April 1, 2016

Function in java

Functions in java or any other language helps to reduce the lines of codes in our program.
Suppose we have to perform a particular task repeatedly but not continuous repetition like loops then instead of writing those line of code we used to make a function with some name just need to call it at the time of our need.
      Function has following  parts:-
·         Name : As the name suggests, the function should have proper name.
·         Definition : definition means function should have those statements that are performing the required task.
·         Return type: return type says that what type of value a function returns whether it is integer, character etc.
NOTE: Return type of a function could be void which means it does not return nay value.
·         Arguments :the parameters on which the task is to be performed.
NOTE: it is not necessary for a function to have a arguments.
Syntax :
           return_type function_name(arguments)
                  {
                    // statements
               }
Example:
1.       class Function {
2.       void display (int n)        //CREATION OF FUNCTION                                                       
3.       {
4.       System.out.println("Function with arguments and without any return statement");
5.       }
6.       int show()
7.       {
8.       System.out.println("Function without arguments but with return value");
9.       return 10;
10.   }
11.   public static void main(String [] args)
12.   {
13.   Function fn=new Function();
14.   int rtrn;
15.   fn.display(10); //CALLING FUNCTION display()
16.   rtrn=fn.show();// CALLING FUNCITON show()
17.   }
18.   }
On running the above program we get the output as:


Important points to remember regarding function:

  1.            A function may or may not return any value.
  2.           A function may or may not have arguments.
  3.          It is not necessary that function is in same class in which it is called.
  4.           A function without any argument may return a value and vice versa.

THANK YOU FOR READING THIS ARTICLE.
PLEASE SHARE IT ON FACEBOOK,TWITTER AND OTHER SOCIAL NETWORKS AND RECOMMEND YOUR FRIENDS TOO.
Kishan Agarwal



Please Share


Thursday, March 31, 2016

how to make decisions

Hello friends you should be aware of decision making statements in java i.e. steps to be taken or statements to be executed by the java compiler if any unwanted condition arises. Before reading further you should have good knowledge of operators in java.
Ø  if-statement: if statement is given with a Boolean expression in the pair of parentheses and the statement hgiven between the pair of curly braces is executed only if the condition is true.
Syntax: if(condition) {
  // Statements to be executed
}
Example: int x=10;
                  If(x==10) //checking if x is equal to 10
                        {
                      System.out.println(“the value of x is”+x);                 /*this statement will be executed only if the condition x=10 is true*/
                         }
*NOTE: The condition given inside parenthesis is false then the whole statement given inside ifblock is skipped and the next statement is executed.
Ø  if-else statement: The if block of this statement is executed as same as if-statement but if the condition of if block is false then else statement if executed.
Syntax: if(condition) {
  // Statements to be executed
}
else {
//Statements to be executed if the condition if-block is false.
}
Example: int x=10;
                  If(x==9) //checking if x is equal to 10
                        {
                      System.out.println(“If statement is executed”);                 /*this statement will be executed only if the condition x=9 is true*/
                         }
                 else {
                         System.out.println(“Else statement is executed”);
                         }
Ø  Switch statement: in switch statement a variable is passed to a switch block and that variable is tested for each case( present in the switch block). That statement is executed whose case matches with the variable.
Syntax: switch(variable1) {
              case ‘a’: //statement one
                               break;
              case ‘b’: //statement two
                               break;
      default:         //this statement will be executed if none of the case variable matches with the variable1.
  }
NOTE: the default case does not have any break statement because it is the last statement which is executed by the switch block.
Example: int x=10;
 switch(x) {
                 case 5: //statement one
                               break;
                case 10: //statement one –this statement will run because x=10
                               break;
                default://default statement
                }
Ø  Nested if-else: in nested if else as the name suggests one if statement has many if-else statement inside its block.
Ø  else-if ladder: in this statement an else block has so many if-else statement inside it.
*NOTE: ANY IF STATEMENT MAY OR MAY NOT HAVE AN ELSE STATEMENT BUT EVERY ELSE STATEMENT HAS A IF STATEMENT.

THANK YOU FOR READING THIS ARTICLE.
PLEASE SHARE IT ON FACEBOOK,TWITTER AND OTHER SOCIAL NETWORKS AND RECOMMEND YOUR FRIENDS TOO.
Kishan Agarwal



Please Share


Wednesday, March 30, 2016

Loops in java

Hello guys today I will tell you something about loops used in java for repetitions. Suppose you have to print your name 100 times on the output screen. Then it would be little cumbersome to use System.out.println(“My name is XYZ”);  100 times so it could achieved easily using loops.
Java has three kinds of loops:-
Ø  for loop: this loop is used when we know the no. of repetitions to be done. for loop has three statement  1.instialisation 2.condition 3.updation.
Syntax :   for(initialization;condtion;updation)
                 {
                    //Statements to be executed
                }
Example : for(i=1;i<=100;i++)
                         {
                         System.out.println(“My name is XYZ”);
                         }
This statement will print ypu name for 100 times.
Ø  while loop: this loop can also be used for above task but it is generally used when we do not know the number of repetitions.
Syntax :   while(condition)
              {
                    //Statements to be executed
                }
Example: int i=1;
                 while(i<=100)
                      {
                          System.out.println(“My name is XYZ”);
                          i++;
                     }
Ø  do-while loop: this loop is used when need to execute any statement atleast one time and further repetitions depend upon some condition.
Syntax: do
                    {
                    //Statements to be executed
                }while(condition);
If we use do-while loop for repetitions then first compiler will execute the statement written inside the do braces without checking any conditions after that further repetitions would be carried on if the condition present inside the while part is true.
 Example: int i=1;
                do
                      {
                          System.out.println(“My name is XYZ”);
                          i++;
                     }while(i<=99);

THANK YOU FOR READING THIS ARTICLE.
PLEASE SHARE IT ON FACEBOOK,TWITTER AND OTHER SOCIAL NETWORKS AND RECOMMEND YOUR FRIENDS TOO.
Kishan Agarwal



Please Share


Tuesday, March 29, 2016

operators in java

Hello guys I am back with a new tutorial on java, you can read my previous on either of the link given below:
So let’s start today I will tell you something about operators in java. Java has basically
1.       Relational operator (<,>, ==, != ) : they are used to evaluate a relation between two equations or more. It returns a Boolean value either true or false.
Example:
class Operator{
  public static void main(String[] args)
    {
                 System.out.println(5<4);
                 System.out.println(5>4);
                 System.out.println(5==4);
                 }
                }
On executing this code we will get:
false
true
false


2.       Bitwise operator ( &,|,^,~): they are used to perform operations like AND,OR , XOR NOT respectively. It performs respective operations with the binary code of the operands and returns the result in decimal number system.
Example
 class Operator{
  public static void main(String[] args)
    {
                 System.out.println(5|4);
                 System.out.println(5^4);
                 System.out.println(5&4);
               System.out.println(~4);
                 }
                }
After execution of above code we get the output as
5
1
4
-5
3.       Logical operator (&&,||,!): logical AND, logical OR, logical NOT(it is just used to reverse the result if the result is true then it will make it false and vice versa) are used basically used when we require any logical operations to be performed on a set of operands. They are generally used with “if” and “while” conditions. It also returns Boolean value
Example :
  class Operator{
  public static void main(String[] args){
                  if((5<6)||(2>3)){
                    System.out.println("This statement will run if either of the conditions is true");
                 }
                if((5>4)&&(4<10)){
                    System.out.println("This statement will run if both the conditions are true");                 }
   }
}
Output:
This statement will run if either of the conditions is true
This statement will run only if both the conditions are true
4.       Assignment operator: assignment operator is nothing but jus a equal “=” ssign which is used to assign a value to any variable.
Example: a=5; // this will assign the value to the variable a.
5.       Conditional or ternary operator (? :): this operator works as same as “if-else” statement however it is not in practice because sometime it becomes cumbersome to use this.
Syntax a=4>5?4:5; this means as same as
    if(4>5)
    a=4;
    else
    a=5;
6.       Unary operator: (++,--): this operator just needs only one operand to be operated on. It has the same meaning variable+1 or variable-1.
Example:  a++; or ++a //a=a+1
                  a--; or --a;// a=a-1
Note: however it also becomes little cumbersome job when unary operator (++,--) is used with an assignment operator (=).
x=y++; //first x will be assigned the value of y then y will be incremented by one.
x=++y; // first the value of y will be incremented by one then it will be assigned to x.
Same case goes for –.
7.       Shift operator(<<,>>): it is used to modify the value either by shifting of the operand present at the left of shift operator left or to the right by the number of bits present at the right of the shift operator. The symbols have their respective meanings (<<left shift >> right shift).
Syntax: 5>>1 will give 2 and 5<<1 will give 10.
Note: right shift decrease the value and left shift increase the value.
The whole process of shifting is carried on after converting the decimal number into its equivalent binary.



THANK YOU FOR READING THIS ARTICLE.
PLEASE SHARE IT ON FACEBOOK,TWITTER AND OTHER SOCIAL NETWORKS AND RECOMMEND YOUR FRIENDS TOO.

Kishan Agarwal

Please Share


Monday, March 28, 2016

You should know bout these before starting

Hello guys today I will make you aware bout those things which one should know before learning java.
  1. Class: it is a collection of similar type of objects which is used to keep same type of data together in java. Example class of student, collection of non-living things, vehicles are all the examples of class.
  2. Object: it is reference variable which is used to access members of a class which could be methods, variables etc.
  3. Methods: methods may be defined as a functions which are made to perform special type of tasks in a program.                                                                                                                   NOTE:  Every java program must contain a main() method which is the heart and soul of a java program.
  4. Data types: data types are integers, Boolean, double etc. which are used in a program frequently. Below is a table of data types and other information related to those which you should be aware of:-
Type
Size in Bytes
Range
byte
1 byte
-128 to 127
short
2 bytes
-32,768 to 32,767
int
4 bytes
-2,147,483,648 to 2,147,483, 647
long
8 bytes
-9,223,372,036,854,775,808 to 
9,223,372,036,854,775,807
float
4 bytes
approximately ±3.40282347 E+38F 
(6-7 significant decimal digits) 
Java implements IEEE 754 standard
double
8 bytes
approximately ±1.79769313486231570 E+308 
(15 significant decimal digits)
char
2 byte
0 to 65,536 (unsigned)
Boolean
not precisely defined*



  1. Keywords: they are the reserved names or sequence of characters which cannot be used as variable name or any other purpose. Example int cannot be used as a variable name.
  2. Identifiers: they are the names given to methods, variables, classes etc through which they are referenced.
They must start with an alphabet.
After an alphabet there could be any sequence of characters and numbers.
Identifiers are case sensitive

THANK YOU FOR READING THIS ARTICLE.
PLEASE SHARE IT ON FACEBOOK,TWITTER AND OTHER SOCIAL NETWORKS AND RECOMMEND YOUR FRIENDS TOO.
Kishan Agarwal


Please Share