Friday, May 13, 2016

AJAX

What is AJAX?

AJAX = Asynchronous JavaScript and XML.

AJAX is based on internet standards, and uses a combination of:
  • XMLHttpRequest object (to retrieve data from a web server)
  • JavaScript/DOM (to display/use the data)

The keystone of AJAX is the XMLHttpRequest object.

The XMLHttpRequest Object

All modern browsers support the XMLHttpRequest object.
The XMLHttpRequest object is used to exchange data with a server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

Create an XMLHttpRequest Object

All modern browsers (Chrome, IE7+, Firefox, Safari, and Opera) have a built-in XMLHttpRequest object.
Syntax for creating an XMLHttpRequest object:
variable new XMLHttpRequest();

Thursday, May 12, 2016

wallpaperSWAP

Create a wallpaperSWAP in android
WRITE A CODE IN MAIN.XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/Change"
android:layout_height="wrap_content"
android:id="@+id/textView1"
android:layout_width="match_parent">
</TextView>

<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/radio0" android:text="@string/onem"
android:checked="true"
android:layout_width="match_parent">
</RadioButton>
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/radio1"
android:text="@string/five"
android:layout_width="match_parent">
</RadioButton>
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/radio2"
android:text="@string/ten"
android:layout_width="match_parent">
</RadioButton>
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/radio3"
android:text="@string/thirty"
android:layout_width="match_parent">
</RadioButton>
<RadioButton
android:layout_height="wrap_content"
android:id="@+id/radio4"
android:text="@string/oneh"
android:layout_width="match_parent">
</RadioButton>

</RadioGroup>

<Button
android:layout_height="wrap_content"
android:text="@string/Set" android:id="@+id/button1"
android:layout_width="match_parent"
android:textSize="25sp">
</Button>

<Button
android:layout_height="wrap_content"
android:text="@string/Unset" android:id="@+id/button2"
android:layout_width="match_parent"
android:textSize="25sp">
</Button>

</LinearLayout>

WALLPAPERMAIN.java
package com.example.wallswap;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.content.Intent;

import android.os.Bundle;

public class WallSwapActivity extends Activity {
    /** Called when the activity is first created. */
private Button mSetButton;
private Button mUnsetButton;
private RadioButton mOneMinRadio;
private RadioButton mFiveMinRadio;
private RadioButton mTenMinRadio;
private RadioButton mThirtyMinRadio;
private RadioButton mOneHourRadio;
private RadioGroup mTimeRadioGroup;
public int mChangeTime = 60;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mSetButton = (Button)findViewById(R.id.button1);
        mUnsetButton = (Button)findViewById(R.id.button2);
        mOneMinRadio = (RadioButton)findViewById(R.id.radio0);
        mFiveMinRadio = (RadioButton)findViewById(R.id.radio1);
        mTenMinRadio = (RadioButton)findViewById(R.id.radio2);
        mThirtyMinRadio = (RadioButton)findViewById(R.id.radio3);
        mOneHourRadio = (RadioButton)findViewById(R.id.radio4);
        mTimeRadioGroup = (RadioGroup)findViewById(R.id.radioGroup1);
        mUnsetButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent mDisableIntent = new Intent(WallSwapActivity.this, WallpaperChangeService.class);
            stopService(mDisableIntent);
            finish();
        }
        });

        mSetButton.setOnClickListener(new OnClickListener() {

        @Override

        /* Set the value of mChangeTime variable according to the radio button selected by the user */

        public void onClick(View arg0) {
        int mRadioID = mTimeRadioGroup.getCheckedRadioButtonId();
        if(mOneMinRadio.getId()==mRadioID){mChangeTime=60;}
        else if(mFiveMinRadio.getId()==mRadioID){mChangeTime=5*60;}
        else if(mTenMinRadio.getId()==mRadioID){mChangeTime=10*60;}
        else if(mThirtyMinRadio.getId()==mRadioID){mChangeTime=30*60;}
        else if(mOneHourRadio.getId()==mRadioID){mChangeTime=60*60;}

        /* Create an intent destined for the service */
        Intent mServiceIntent = new Intent(WallSwapActivity.this, WallpaperChangeService.class);

        /* Create a bundle and store in it a key-value pair specifying the time after which the wallpaper needs to be changed. */

        Bundle mBundleTime = new Bundle();
        mBundleTime.putInt("time", mChangeTime);

        /* Attach the bundle to the intent */

        mServiceIntent.putExtras(mBundleTime);

        /* Start the service */
        startService(mServiceIntent);

        /* End the activity */
        finish();
        }
        });
    }
}

WALLPAERCHANGESERVICES.JAVA
package com.example.wallswap;

import android.app.Service;
import android.os.Bundle;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import android.content.Intent;
import android.os.IBinder;

public class WallpaperChangeService extends Service implements Runnable {

/* Store references to the wallpaper images in an array */
private int wallpaperId[] = {R.drawable.wallpaper1,R.drawable.wallpaper2};
/* Declare a variable to store the time selected by the user */
private int time;

/* Declare a flag to check which image to display next */
private int FLAG=0;

private Thread t;

/* Declare two bitmap objects to store the wallpaper images */
private Bitmap bitmap;
private Bitmap bitmap1;

@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
/* The overridden onStartCommand() method */
@Override
public int onStartCommand(Intent intent, int flag,int startId)
{
super.onStartCommand(intent,flag, startId);
/* Obtain the bundle sent along with the intent sent from the activity */
Bundle bundle=intent.getExtras();
/* Obtain the value of the time key */
time = bundle.getInt("time");

/* Initialize the Bitmap objects with the wallpaper images */
bitmap=BitmapFactory.decodeResource(getResources(),wallpaperId[0]);
bitmap1=BitmapFactory.decodeResource(getResources(),wallpaperId[1]);

/* Start a new thread to keep the service running in the background. */
t = new Thread(WallpaperChangeService.this);
t.start();
return 0;
}

/* The overridden onDestroy() method */

@Override
public void onDestroy(){
super.onDestroy();
System.exit(0);
}

/* The run() method containing code that is executed by the newly created 
thread */
@Override
public void run() {
// TODO Auto-generated method stub
try {
while(true){
if(FLAG==0) {
this.setWallpaper(bitmap);
FLAG++;
}
else{
this.setWallpaper(bitmap1);
FLAG--;
}
Thread.sleep(1000*time);
}
} catch (Exception e){
e.printStackTrace();
}
}

}


Friday, April 8, 2016

Index & Edit


INDEX.php

<!DOCTYPE html >
<html l">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Student Information</title>
<link rel="stylesheet" type="text/css" href="Style/viewtablesearch.css" />
</head>
<body>
<center><h1>Welcome to Student</h1></center>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="addnew" href="Add_Form.php" style="font-face:Khmer OS Battambang; font-size:16px;">ចុចត្រង់នេះដើម្បីបន្ថែម Record ថ្មី</a></font>
<div class="search">
<form method="post" action="searchidandname.php">
    <select name="cbosearch">
    <option>ID</option>
    <option>Name</option>
        <option>Gender</option>
        <option>Address</option>
    </select>
<input type="text" name="txtsearch" placeholder="Type to Search" /><input type="submit" name="cmdsearch" value="Search" />
    </form>
    </div>
<table>
    <tr>
            <th>StuID</th>
            <th>StuName</th>
            <th>Gender</th>
            <th>Date of Birth</th>
            <th>Address</th>
            <th>Subject</th>
            <th>Registered Date</th>
            <th>Option</th>
    </tr>
        <?php
include "connect.php";
$i = "select * from tbl_student";
$h = mysql_query($i);
while($tr=mysql_fetch_array($h))
{

?>
        <tr>
        <td><?php echo $tr[0]; ?></td>
            <td><?php echo $tr[1]; ?></td>
            <td><?php echo $tr[2]; ?></td>
            <td><?php echo $tr[3]; ?></td>
            <td><?php echo $tr[4]; ?></td>
            <td><?php echo $tr[5]; ?></td>
            <td><?php echo $tr[6]; ?></td>
            <td align="center"><a href="Delete_Form.php? txtid=<?php echo $tr[0];?>">Delete</a> / <a href="Edit_Form.php? txtid=<?php echo $tr[0];?>">Edit</a> </td>  
        </tr>
        <?php
}
?>

    </table>
</body>
</html>



ADD.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Form</title>
<link href="Style/Add_Form.css" rel="stylesheet" type="text/css" />
</head>

<body bgcolor="#99CC66" background="Images/MyBackground.png">
<div class="img"><img src="Images/auditoria.png" /></div>
<div class="ii"><center><img src="Images/Edit_Yes.png" style="margin-top:20px"/></center></div>
<div id="topbar">
    <center><h1 style="color:#939">Welcome to Add Form</h1>
    </div>
<div id="form">
<table>
        <form method="post" action="">
            <tr>
             
                <?php
include ("connect.php");
$g = mysql_query("select max(stuid) from tbl_student");
while($id=mysql_fetch_array($g))
{
?>
             
                <th>ID:</th>
                    <td><input type="text" name="txtid" value="<?php echo $id[0]+1; ?>" readonly="readonly" /></td>
                </tr>
                <?php
}
?>
                <tr>
                <th>Name:</th>
                    <td><input type="text" name="txtname" placeholder="Type Name"  /></td>
                </tr>
                <tr>
                <th>Gender:</th>
                    <td><select name="txtgender">
                    <option>Select Gender</option>
                        <option>Male</option>
                            <option>Felmale</option>
                       </select>
                    </td>
                </tr>
                <tr>
                <th>Date of Birth:</th>
                    <td>
                    <select name="txtday">
                        <option>Day</option>
                            <?php
                            //Do Loop while
$d=0;
do{
$d++;
echo "<option>".$d."</option>";
}while($d<=30);
?>
                        </select>
                        <select name="txtmonth">
                        <option>Month</option>
                            <?php
//For Loop
$m=array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for($i=0;$i<count($m);$i++){
echo"<option>".$m[$i]."</option>";
}
?>

                        </select>
                        <select name="txtyear">
                        <option>Year</option>
                            <?php
                            //While Loop
$y=2021;
while($y>=1950){
$y--;
echo "<option>".$y."</option>";
}
?>
                        </select>
                    </td>
                </tr>
                <tr>
                <th>Address:</th>
                    <td><textarea cols="19px" rows="3" name="txtaddress" placeholder="Type Your Address"  /></textarea></td>
                </tr>
                <tr>
                    <th>Subject:</th>
                    <td>
                    <select name="txtsubject">
                        <option>Select Subject</option>
                            <?php
                            $s=array("Java Script","VB.NET","Graphic Design","PHP & MySQL","C#","C","C++","VBA","HTML and CSS");
for($i=0;$i<count($s);$i++)
{
echo "<option>".$s[$i]."</option>";
}
                            ?>
                        </select>
                    </td>
        </tr>
                <tr>
                <th>Register Date:</th>
                    <td><input type="text" name="txtdate" value="<?php echo date("d/M/Y"); ?>" readonly="readonly" /></td>
                </tr>
                <tr>
                    <td><input type="submit" name="cmdadd" value="Add" /></td>
                    <td><input type="reset" name="cmdreset" value="Clear"/></td>
                </tr>
        </form>
        </table>
    </div>
        <?php
        $id = $_POST['txtid'];
        $name = trim($_POST['txtname']);
        $gender = trim($_POST['txtgender']);
        $dob = trim($_POST['txtday']."/".$_POST['txtmonth']."/".$_POST['txtyear']);
        $address = trim($_POST['txtaddress']);
        $sub = trim($_POST['txtsubject']);
        $date = trim($_POST['txtdate']);
        if(isset($_POST['cmdadd'])){
        if(empty($name) || $gender=="Select Gender" || $_POST['txtday']=="Day" || $_POST['txtmonth']=="Month" || $_POST['txtyear']=="Year" || empty($address) || $subject=="Select Subject")
        {
            echo "<center>Sorry please input data</center>";
        }else{
        include "connect.php";
        $i = mysql_query("insert into tbl_student values('".$id."','".$name."','".$gender."','".$dob."','".$address."','".$sub."','".$date."')");
        if($i==true){
        echo '';
        }
        if($i==true){
        header('Location:index.php');
        exit;
        mysql_close();
        }
        }
    }
    ?>
</body>
</html>


EDIT.php


<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Form</title>

<link rel="stylesheet" type="text/css"  href="Style/Edit_Form.css" />

</head>

<body background="Images/MyBackground.png" bgcolor="#FFCC99">
<div class="topbar"> <h1 style="color:#FFF"><center>Edit Form</center></h1></div>    
<center>
    <div class="box">
    <?php
$id = $_GET['txtid'];
include ("connect.php");
$i ="select * from tbl_student where stuid=".$id;
$h= mysql_query($i);
if($tr=mysql_fetch_array($h))
{
?>
    <table><form method="post" action="">
    <tr>
        <th>ID:</th>
        <td><input type="text" name="txtid" value="<?php echo $tr[0]; ?>"/></td>
        </tr>
        <tr>
        <th>Name:</th>
        <td><input type="text" name="txtname" value="<?php echo $tr[1]; ?>" /></td>
        </tr>
        <tr>
        <th>Gender:</th>
        <td>
            <input type="text" name="txtgender" value="<?php echo $tr[2]; ?>" /></td>
            </td>
        </tr>
        <tr>
        <th>Date of Birth:</th>
        <td><input type="text" name="txtdob" value="<?php echo $tr[3]; ?>" /></td>
        </tr>
        <tr>
        <th>Address:</th>
        <td><textarea cols="16" rows="3" name="txtaddress"> <?php echo $tr[4];?> </textarea></td>
        </tr>
        <tr>
        <th>Subject:</th>
        <td><input type="text" name="txtsubject" value="<?php echo $tr[5]; ?>" /></td>
        </tr>            
        <tr>
        <th>Edited Date:</th>
            <td><input type="text" name="txtdate" value="<?php echo $tr[6];?>"/></td>
        </tr>
            <?php
}
?>
        <td colspan="2" align="center"><input type="submit" name="cmdedit" value="Save" />
            <a href="index.php"><img src="Images/Users_Group.png" title="Go Back"/></a>
            </td>
        </tr>
</form></table>
    </div>
    </center>
    <?php
        include ("connect.php");
        $i = mysql_query("update tbl_student set name='".$_POST['txtname']."', gender='".$_POST['txtgender']."', dob='".$_POST['txtdob']."', address='".trim($_POST['txtaddress'])."', sub='".$_POST['txtsubject']."', date='".$_POST['txtdate']."' where stuid=".$_POST['txtid']);
        if($i==true){
        echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">';
        }
        //header('Location::index.php');
        //exit;
        //mysql_close();
    ?>
</body>

</html>



Monday, March 28, 2016

transaction

transaction

A TRANSACTION IS AN EVENT OR HAPPENING THAT CHANGES AN ORGANISATION "S FINANCIAL POSITION AND/OR ITS EARNING.

Sunday, March 6, 2016

form to insert data in database

<html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost';
            $dbuser = 'prakash';
            $dbpass = '123';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

 <html>
  
   <head>
      <title>Add New Record in MySQL Database</title>
   </head>
  
   <body>
      <?php
         if(isset($_POST['add'])) {
            $dbhost = 'localhost:3036';
            $dbuser = 'root';
            $dbpass = 'rootpassword';
            $conn = mysql_connect($dbhost, $dbuser, $dbpass);
           
            if(! $conn ) {
               die('Could not connect: ' . mysql_error());
            }
           
            if(! get_magic_quotes_gpc() ) {
               $emp_name = addslashes ($_POST['emp_name']);
               $emp_address = addslashes ($_POST['emp_address']);
            }else {
               $emp_name = $_POST['emp_name'];
               $emp_address = $_POST['emp_address'];
            }
           
            $emp_salary = $_POST['emp_salary'];
           
            $sql = "INSERT INTO employee ". "(emp_name,emp_address, emp_salary,
               join_date) ". "VALUES('$emp_name','$emp_address',$emp_salary, NOW())";
              
            mysql_select_db('test_db');
            $retval = mysql_query( $sql, $conn );
           
            if(! $retval ) {
               die('Could not enter data: ' . mysql_error());
            }
           
            echo "Entered data successfully\n";
            
            mysql_close($conn);
         }else {
            ?>
           
               <form method = "post" action = "<?php $_PHP_SELF ?>">
                  <table width = "400" border = "0" cellspacing = "1"
                     cellpadding = "2">
                 
                     <tr>
                        <td width = "100">Employee Name</td>
                        <td><input name = "emp_name" type = "text"
                           id = "emp_name"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Address</td>
                        <td><input name = "emp_address" type = "text"
                           id = "emp_address"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100">Employee Salary</td>
                        <td><input name = "emp_salary" type = "text"
                           id = "emp_salary"></td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td> </td>
                     </tr>
                 
                     <tr>
                        <td width = "100"> </td>
                        <td>
                           <input name = "add" type = "submit" id = "add"
                              value = "Add Employee">
                        </td>
                     </tr>
                 
                  </table>
               </form>
           
            <?php
         }
      ?>
  
   </body>
</html>

java

 java
  • Can we overload main method ?
  • Constructor returns a value but, what ?
  • Can we create a program without main method ?
  • What are the 6 ways to use this keyword ?
  • Why multiple inheritance is not supported in java ?
  • Why use aggregation ?
  • Can we override the static method ?
  • What is covariant return type ?
  • What are the three usage of super keyword?
  • Why use instance initializer block?
  • What is the usage of blank final variable ?
  • What is marker or tagged interface ?
  • What is runtime polymorphism or dynamic method dispatch ?
  • What is the difference between static and dynamic binding ?
  • How downcasting is possible in java ?
  • What is the purpose of private constructor?
  • What is object cloning ?

Friday, March 4, 2016

JAVA PROGRAM(ALPHABET PATTERN)

 JAVA  PROGRAM(ALPHABET PATTERN)
A
AB
ABC
ABCD


 /*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */

public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
     
  for(int i=1;i<5;i++)
        {
            int a=65;                          //ASCII value of A
            for(int j=1;j<=i;j++)
              {
                System.out.print((char)a);
                a++;
              }
          System.out.println();
        }
    }   
}

2.   A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in); // create scanner obj
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();  // accept a number


char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c='A';
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
++c;
}
c-=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
--c;
}
System.out.println();    // INTRODUCING NEW LINE

}

    }   

}


output
Enter the number of rows. 
6
     A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA
ABCDEFEDCBA



      A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication23;

/**
 *
 * @author Prakash
 */
//enum week{
 //   sun,mon,tue,wed,thurs,fri,sat
//};
import java.util.*;  // import java util 
public class JavaApplication23 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       
  Scanner scr=new Scanner(System.in);
int n;
System.out.println("Enter the number of rows. ");
n=scr.nextInt();

char ch='A';
char c;
for(int i=1;i<=n;++i)        // FOR LOOP FOR NUMBER OF ROWS
{
c=ch;
for(int j=i;j<n;++j)        // FOR LOOP FOR PRINTING SPACES
{
System.out.print(" ");
}
for(int k=1;k<=i;++k)      // FOR LOOP FOR PRINTING ALPHABETS IN DESCENDING ORDER  
{
System.out.print(c);
--c;
}
c+=2;
for(int l=1;l<i;++l)      // FOR LOOP FOR PRINTING ALPHABETS IN ASCENDING ORDER
{
System.out.print(c);
++c;
}
System.out.println();    // INTRODUCING NEW LINE
++ch;                   //  INCREMENTING VALUE OF CH FOR NEXT ITERATION
}

} // end of main method
} // end of main class

/* OUTPUT

    }   
}


run:
Enter the number of rows. 
6
     A
    BAB
   CBABC
  DCBABCD
 EDCBABCDE
FEDCBABCDEF
BUILD SUCCESSFUL (total time: 4 seconds)