NavBar

Wednesday, 13 June 2018

How to create WebSite

                                            Previous Articles

Create First Web Page


My First Web Page

First Page Full Code


<html>
<head></head>
<style type="text/css">
body{
background-image: url("back.jpg");
background-size: 100%;<!it is an background image on page>
}
#navigation {
  padding-left: 350px;
  padding-top:60px;
  margin: 0px;
  text-align: center;
  display:inline-block;
  vertical-align:top;
  font-size: 150%;
font-weight: bold;
  }
a{
color: black;
 text-decoration: none;
}
a:hover{
color: red;
}
</style>
<body>
<div id="navigation">
<tr>
<td><a href="
webcoderscode.blogspot.com">Home&nbsp;&nbsp;|</td></a>

</tr>
<tr>
<td>&nbsp;&nbsp;<a href="
webcoderscode.blogspot.com">About Us&nbsp;&nbsp;|</td></a>

</tr>
<tr>
<td>&nbsp;&nbsp;<a href="
webcoderscode.blogspot.com">Gallery&nbsp;&nbsp;&nbsp;|</td></a>

</tr>
<tr>
<td>&nbsp;&nbsp;<a href="
webcoderscode.blogspot.com">Menu&nbsp;&nbsp;|</td></a>

</tr>
<tr>
<td>&nbsp;&nbsp;<a href="
webcoderscode.blogspot.com">Contact us</td></a>

</tr>
</div></br>
</body>
</html>

Difference Between Web Site And Web Applications

                                       Previous Articles


Web Site

A web site is a collection of related web pages.It includes multimedia content typically identified with unique domain name and published on at least one web server.A web site may be accessible via public internet protocol or private local area networks by using uniform resource locator.
A web site can used for many purposes like web site can be a personal website,corporate website for organization,a govt.website.
A web site is typically developed for providing information,services,some web sites are for entertainment,news etc.
All publicly accessible websites collectively constitute the WWW,while private websites,such as a organization's website for its employee,these websites are part of intranet.


There are two types of Web Sites

1.Static Web Site

2.Dynamic Web Site 


1.Static Web Site:-
  • A static website is one that has web pages stored on the server in the format that is sent to a client web browser.
  • All web site is developed in HTML and CSS languages.
  • In static web sites images are commonly used to effect the desired appearance and as part of the main content. 
  • This type of web sites display same information for all users.

2.Dynamic Web Site:-
  • A dynamic website changes or customizes itself frequently and automatically. 
  • All Web site is developed in HTML,CSS,PHP,JAVASCRIPT languages.
  • A site can display the current state of a dialogue between users, monitor a changing situation, or provide information in some way personalized to the requirements of the individual user.
  • This type  of web sites uses Database Management Systems.
  • This web sites create databases using Structure query Languages.(SQL)

Web Application

A Web application is a computer program that uses web browser and web technologies to perform task over the internet.
The web application required web server to manage request from the client an application server to perform the task requested to store information on databases.
Web applications can run on multiple platforms.Basically web applications are  use for business purpose. 

                                      Next Articles

Web Site Development Languages.

                                                 Previous Articles

Why Website is important?

  • 24/7 Accessibility.
  • Convince.
  •  Your product or information show in worldwide.
  • It provides social proof. 
  • Website is a marketing channel.

Popular languages for developing attractive websites.


1.HTML

2.CSS

3.JAVASCRIPT

4.PHP

5.AJAX

6.JQUERY

7.JAVA


1.HTML:- HTML stands for HYPER TEXT MARKUP LANGUAGE .It is an standard language for creating websites and web applications.HTML was created by Berners-Lee in late 1991 but "HTML 2.0" was the first standard HTML specification which was published in 1995.HTML describes the structure of web pages using markup.HTML elements are represented by tags.The output shown in the browser.like(Google Chrome,Firefox,IE,Safari). 

Sample Code Of HTML


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>WelCome Web Coders</h1>
<p>This Is My First Paragraph</p>

</body>
</html>


2.CSS:- CSS stands for CASCADING STYLE SHEETS.cascading style sheets describes the style of an HTML document. CSS  describe how HTML content display.Using CSS we also set height,width,color,size of content & many more.

Sample Code Of CSS

body {
    background-color:#33FFFO 
;
}

h1 {
    color: black;
    text-align: center;
}

{
    font-size: 20px;
}


3.JavaScript:-JavaScript is an high level-interpreted programming language.JavaScript enables interactive web pages and hens it is an important part of an web Sites.





4.PHP:- PHP is an server side scripting language for developing dynamic web pages.PHP is free for use.PHP stands for hypertext preprocessor.PHP code may be embedded into HTML code or it can be used in combination with different web templates.Using PHP we also create databases.


Sample Code Of PHP

<html>
<html>
<body>

<?php
echo "My first PHP Page...";
?>

</body>
</html>


5.JAVA:-Java is an general purpose computer programming language that is class based object oriented language.We can create desktop applications as well as web applications using java.For building web applications we use Servlet,JSP,Struts,Hibernet technologies.


                                                 Next Articles


Monday, 23 April 2018

what is a constructor and types of constructor

Constructor

  • Constructor is a special,method which is used to initialize the object at the time of creation.
  • Constructor is a member function of class and initializes objects of a class.

Characteristics of constructor

  • Constructor does not have return type,not even void.
  • In constructor the method name is same as the class name.
  • Constructor can be overloaded.
  • Constructor  can invoke automatically.

Types of constructor



1.Default Constructor:-
  • If no constructor are defined for a class,the compiler automatically generate default constructor.
  • Default constructor don't have parameters.
2. Parameterized Constructor:-
  • If any constructor which have parameters then it is called parameterized constructor.
  • Constructor is also overloaded (java allows overloading of constructor as well as methods).
//Syntax for Default and Parameterized constructor

public DemoConstructor
{
       int num1=45;               // Defining Default Constructor 
       int num2=65;
}

public DemoConstructor(int x,int y)↑・Ҝ.↑↑↑
{
      num1=x;                   //Defining Parameterized Constructor
      num2=y;
}

DemoConstructor dc=new DemoConstructor();              //Default Constructor Object Creation

DemoConstructor dc1=new DemoConstructor(20,30);  //Parameterized Constructor Object Creation

                                                                           

what is Multithreading in java with example

   Multithreading:-

  • Java provides built in support for multithreaded programming concept .
  • Process of executing multiple threads simultaneously.
  • Multiprocessing and multithreading,both are used to achieve multitasking.
  • A multithreaded program contains two or more parts that can run concurrently.
  • Multithreading is mostly used in games, animation etc.
  • Thread is basically  lightweight sub process.
  • Cost of communication between the thread is low.

Life Cycle of Thread (Thread states)

what is Multithreading in java with example

New:-When a new thread object is created the thread is said to be new state. 

2.Runnable:- When start()method is invoke on thread it is said to be in runnable state.It is only                                      ready for run.

3.Running:- In this state the thread is actually executting a code.

4.Blocked:- A thread can move to block or wait state at any time.

5.Dead:- The thread has finished his work and moves to dead state.


                  
Multithreding programs are run above 5 states.

Creating a thread:-


Thread can be created using two ways.
  1. By defining class that extends the thread class.
  2. By implementing the runnable interface.
Note:-(In both cases run method should be implemented)



1.Extending the thread class:-

For example:-
                        public class MyThread extends Thread
                        {
                                  public void run()
                                  {
                                        System.out.println("This is Thread 1");
                                   }
                         }

                      MyThread t1=new MyThread();                 //Creating object of thread
                      t1.start();                                                     //Start thread

     2.Implementing runnable interface:-


                          public class MyThread extends Thread
                        {
                                  public void run()
                                  {
                                        System.out.println("This is Thread 2");
                                   }
                         }
                             MyThread t1=new MyThread();          //Creating object of thread
                             Thread t=new Thread(t1);
                              t1.start();                                             //Start thread


// Demo program for Runnable

public class Abc implements Runnable {
    public void run()
    {
        for(int i=0;i<=10;i++)
            System.out.println("i="+i);
    }
}

public class Xyz implements Runnable {
    public void run()
    {
        for(int j=0;j<=5;j++)
            System.out.println("j="+j);
    }

public class Multithreading  {
  public static void main(String[] args) {
       Abc obj1=new Abc();
       Xyz obj2=new Xyz();
       Thread T1=new Thread(obj1);
       Thread T2=new Thread(obj2);
       obj1.start();
       obj2.start();
    }
    
}

isAlive() and join() method:- 


  • isAlive():- This method is used to test wheather a thread is still alive.It returns true if the thread is running,otherwise it runs false.
  • join():- This method is used to halt the execution of current thread untile the thread on which the method is called finishes its execution.

//Demo program for isAlive() and join() methods

package multidemo;
public class Abc extends Thread {
    public void run()
    {
        for (int i=0;i<-10;i++)
        {
            if(i==5)
            {
                stop();
            }
            System.out.println("i="+i);
        }
    }
}


package multidemo;
public class Xyz extends Thread{
    public void run()
    {
        for(int j=0;j<=5;j++)
        {
            if(j==3)
            {
                try
                {
                    sleep(2000);
                }
                catch(Exception e)
                {
                    System.out.println(e);
                }
            }
            System.out.println("j="+j);
        }
    }
}


public class MultiDemo {
 public static void main(String[] args) {
        Abc obj1=new Abc();
        obj1.start();
        System.out.println("is thread is alive "+obj1.isAlive());
        Xyz obj2=new Xyz();
        try{
            System.out.println("check joining");
            obj1.join();
            obj2.join();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
       obj2.start();
    }
    
}  

Output:-
                       
isAlive() and join() demo java multithreading

Saturday, 17 March 2018

what is static,super,final keywords in java with example.

java keywords


1.Static Keyword:-


  • In java we can set static as variables,methods,blocks.
  • If you declare any variable as static, it is known static variable.
  • The static keyword in java is used mainly for memory management.
  • The static variable can be used to refer the common property of all objects .  
we can discuss static keyword by example:-

class Employee
{
     int empid;
    String empname;
    static String company="HCL";

         Employee(int id,String n)
         {
             empid=id;
             empname=n; 
          }

         void display()
        {
              System.out.println("empid+""+empname""+company);
         }

public static void main(String arg[])
{
      Employee e1=new Employee(101,"Alex");
      Employee e2=new Employee(102,"Mark");
      
     e1.display();
     e2.display();

}
}

Output:- 101   Alex    HCL
              102  Mark   HCL




2.Super Keyword:-


  • The super keyword is also be used to invoke parent class method.
  • It should be used if subclass contains the same method as parent class.
  • In other word it is used if method is overridden.
we can discuss static keyword by example:-

class Animal
{
     void eat()
     {
          System.out.println("Eating.....");
      }

class Dog extends Animal
{
      void eat()
      {
          System.out.println("Eating Bread");
       }
    void bark()
    {
       System.out.println("Barking");
     }
super.eat();             //use of super keyword
}
}

class TestSuper
{
     public static void main(String arg[])
     {
          Dog d1=new Dog();
          d1.bark();
      }
}


Output:-    Eating.....


3.Final Keyword:-

  • Final keyword can be applied to the variable,method,classes
1.Final Variable:-
  • The value of variable can be prevented from being modified by declaring a variable as final.
  • Example:- int Max=100;

2.Final Method:- 
  • A method can be prevented from being overridden by the subclass by declaring the method as final.
  • Example:-
                     final void show()     // can't overridden

3.Final Classes:-
  • A class which can not be further inherited or can not have any subclass is known as final classes.
  • To make a class final,the class declaration is preceded by the final keyword.
  • If class declared as final,all of its methods are automatically declared as final.
  • Example:-
       final class A
      {
               System.out.println("Web Coders");
      } 
      class B extends A           //ERROR
     {
         System.out.println("Can not inherited");
      }

Saturday, 17 February 2018

What is collection in java

Collection:-

  • Collection is a group of object which could be homogeneous or heterogeneous with some size.
  • Collection in java are data structures primary defined through a set of classes and interfaces.
  • It also refer to as a container which contain the group of multiple element into a single unit.

Collections are used for:-

  • To generalized the array concept.
  • To store multiple type of object.
  • To define set of interfaces for storing java objects.
  • Collection is group of classes which gives the functionality of handling vectors,arraylist,hashmap,hashtable,stack etc.

Collection interfaces uses following methods:-

1.add():-To add element in collection.

2.remove():-To remove element from collection.

3.toarray():-Convert collection into array of element.

4.contains():-To check if specified element is in the collection respectively.     

Types Of Collections:-

What is collection in java

Set:-

  • Extends collection interface
  • Does't allow duplicate element.
  • Support all methods present in collection interface.

Types of set:-

1. HashSet class:-

  • Implemented using a hash table.
  • No ordering of element.
Example:-

 import java.util.*;
class TestHashSet
{
        public static void main(String arg[])
        {
                  HashSet obj=new HashSet();
                  obj.add("Apple");
                  obj.add("Orange");
                  obj.add("Apple");
                  obj.add("Banana");
System.out.println("elements are"+obj);
System.out.println("Size is:"+obj.size());
        }
}

Output:- elements are Apple,Orange,Banana
              Size is:- 3


 

   2.TreeSet class:-


  • In this values are sorted in asending order.
  • It implement tree structure.
  • Guarantee ordering of element.
 Example:-

 import java.util.*;
class TestTreeSet
{
        public static void main(String arg[])
        {
                  TreeSet obj=new TreeSet();
                  obj.add("Z");
                  obj.add("A");
                  obj.add("F");
                  obj.add("E");
System.out.println("elements are"+obj);
System.out.println("Size is:"+obj.size());
        }
}

Output:- elements are A E F Z
              Size is:- 4


3.LinkHashSet class:-


  • It is an subclass of hashset.
  • LinkHashSet are doubly linked lists.
  • They are in fix order but not in sorted manner.
 Example:-


 import java.util.*;
class TestLinkHashSet
{
        public static void main(String arg[])
        {
                 LinkHashSet obj=new LinkHashSet();
                  obj.add("One");
                  obj.add("Two");
                  obj.add("Three");
                  obj.add("Four");
System.out.println("elements are"+obj);
System.out.println("Size is:"+obj.size());
        }
}

Output:- elements are One Two Three Four
              Size is:- 4

List:-


  • List is order collection called sequence.
  • Array list and linked list are implementation classes of listinterface.
  • It extends collection interface.
  • It may have duplicate element.
  • In list elements are added at end of list.

 Types of  list:-

1. ArrayList Class:-

  • Array list is an array based implementation where elements can be access directly via get and set menthod.
  • It can dynamically increase or decrease.

2.LinkList Class:-

  • It will give better performance onadd or remove compare to arraylist.
  • It will give poor performance on get and set method compare to arraylist.

Queue:-

  • Queue is a collection used to hold multiple elements prior to processing.
  • Beside basic collection operation a queue provide additional insertion,extraction and innspection operation.
  • In queue ordering is First Come First Out basis(FIFO).