Wednesday, July 6, 2011
Tips and Tricks @SSB for officer in Armed forces
The SSB comprises of 5 days schedule which further comprises of stage 1 and stage 2. The successful candidates of stage 2 have to stay back for 5-7 more days for their detailed medical.
Stage 1:-
This stage is also called screening. This stage is comprises of verbal /non- verbal test in objective format and PPDT(picture perception and Discussion Test).
Verbal/ non-verbal tests are very easy. But time given is very less, hence candidate has to be very quick and correct in his response.
Tricks and Tips for verbal/non- verbal Test
Their will be two test having 50 questions each. First solve very easy questions(are those which can be answered by just reading question only) and leave the rest. Then again start from the beginning and now solve slightly difficult from first ones and go to end. Now again start from beginning solve slightly more difficult and finally solve the most difficult. By this approach you will find that every question has been solved.
Even if u find some questions very difficult or not in your range then go for hit and trail method because there is no negative marking in verbal/non-verbal test.
PPDT
IN PPDT a hazy picture will be shown to you which will be describing some situation and you will be made to write story on the picture .
Tips and Tricks
Your story should be around, what lead to the situation what is going in the situation and what will be the outcome of the situation.
You should not describe the picture itself.
Preferably, make a story which yields positive output.
Rule for analyzing given picture
First look at the center of the image then go extreme left of image ,then go clock wise and come again to same point by this technique you can note almost every detail of the image. These details are very much required in writing and discussing story hence be focused will analyzing picture.
Narration and Discussion part of the story
After writing story candidates are made to sit in groups of around 8 to 16 candidates in each group for narration and discussion of the story.
Tricks and tips
While narrating the story, the key of success is confidence apart from it clear, loud voice good communication skills and positive body language also play vital role in impressive narration.
DISCUSSION
The most important part of the screening test called discussion of the story. The 90% of the selection in screening is based on the discussion of the story.
Tricks and tips
You must initiate the discussion. If some how you can’t initializes discussion you must be the 2nd or 3rd speaker.
You must speak at least 4 times in discussion.
You should not repeat your statements will discussion.
Never go in one- to one conflict with any other candidate But Always address Group not to any individual while discussion.
Never Become the Part of the fish market, but in such situations your duty must be control the group in a gentlemen way.
Remain cool, calm and collective while discussion.
Friends these were the some key points for the stage 1 but the real betel is stage2 of ssb. I will also update some tips and tricks of stage 2 very soon till then…….
Jai Hind.
Saturday, July 31, 2010
Experience at cavalier india
i would also like to recall the names of all people and get them permanently written on my blog so that when they will not in touch with me their memories remain with me and list goes like this
anoop n0.1,anoop no.2,kriti,mehak,anooj,yash,akriti,neelam,geetika (bus itney hi naam yaad aa rhey hai;) ..
sorry coudn't recall remaining names.:) but really it was pure fun in completing srt's,wat, tat and other stuff.yaa! one day also went for out door activities, was quite enjoyble but some of us got hurt.I, anoop and kriti become good friends, use to come back together from cavailer classes and that also after having cappuccino in ccd.
it was the last day of cavalier i , yash and kriti met in ccd. wished each other best of luck and went back to our own ways. these 14 days were really fantastic.
Wednesday, June 23, 2010
first week @ delhi
first two days of office were very much tiring for me. office timing is 10am to 6pm and of-course i was not habitual for such a long sitting and moreover constant working on the computer like a statue make it worse. but it start becoming part of my daily routine and now it seems bit easy.
life at delhi:-
previously , i was only thinking the fast and busy life schedule of delhi... but there are lot many scary factors which make life more difficult and challenging here.. such as pollution, traffic, pure water problem and many more.
in short you should be very fast and adjustable for adjusting in this place.
now, lets talk about the most important thing,i:e my training.
well, they have given me a project under which i have to develop a web application. this web application can be used in further developing the networking sites for the users.
first two days i had studied the related web applications . Then next two days created the data base in my-sql. currently, i have start designing the web pages. currently i am using much of css and html tags in my coding.
oh!! i forget one thing to tell you, that i happened to meet my school friends and it was such a pleasure to meet them. we spent week-end together and enjoyed a lot . visited some good place and metroki sfari was also good experience. feeling better now. but no place on the earth can replace g.n.e. hostel.missing a lot..
lots of love to all my friends i wish all of them best of luck for their training. do well in your training guys.
Monday, May 17, 2010
Living wages
i would like to share that question and answer with you.
define living wage?
ANS:-
Living wage
Living wage is a term used to describe the minimum hourly wage necessary for shelter (housing and incidentals such as clothing and other basic needs) and nutrition for a person for an extended period of time (lifetime). In developed countries such as the United Kingdom or Switzerland, this standard generally means that a person working forty hours a week, with no additional income, should be able to afford a specified quality or quantity of housing, food, utilities, transport, health care, and recreation.
This concept differs from the minimum wage in that the latter is set by law and may fail to meet the requirements of a living wage. It differs somewhat from basic needs in that the basic needs model usually measures a minimum level of consumption, without regard for the source of the income.
Thursday, May 13, 2010
how to install drupal in the linux
How to Install Drupal in ubuntu ?
We need to obtain our copy of Drupal so type in
“sudo wget http://ftp.drupal.org/files/projects/drupal-6.13.tar.gz”
this will download the Drupal file into your current directory.
> We need to unpack the files issue the command
“tar –zxvf drupal-6.13.tar.gz”
this will extract the files into a folder in your home directory
>We need to make a directory in the web root folder to keep the Drupal files in. To do this type in
“sudo mkdir /var/www/drupal”
>We need to move the Drupal content over to the web folder. Type in
“sudo mv drupal-6.13/* drupal-6.13/.htaccess /var/www/drupal”
>We need to set up folders for media associated with the site to do this issue “sudo mkdir /var/www/drupal/sites/default/files”
then
“sudo chown www-data:www-data /var/www/drupal/sites/default/files
>We need to copy and set the Drupal initial config file. To do this we first set copy the settings file by issuing
“sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php”
then we need to make sure this file is accessible by issuing the command
“sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php”
>NEXT we install the following packages:-
apache2 ,php5-mysql, php5-gd ,libapache2-mod-php5 ,mysql-server
Using command on terminal " sudo apt-get install apache2 " similarly other packages
> Then Next we need to make sure there is a database in MySQL that Drupal can use.
mysql -u root -p mysql > create database drupal;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER,
CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupaluser'@'localhost'
IDENTIFIED BY 'drupalpass';
mysql> FLUSH PRIVILEGES;
Quit the mysql prompt:
myspl> \q
> Now we need to restart Apache to make sure the settings take effect. Type in “sudo /etc/init.d/apache2 restart” Final Installation Settings
>open browser and type http://localhost/drupal/ or http://localhost/drupal/index.php
Drupal now needs setting up, most of it is self explanatory but here are the steps:1) Click on install Drupal in English
2) Type in the database name in this example it was called ‘Drupal’
3) Type in the username for the MySQL account for Drupal in this example it is ‘drupaluser’
4) Type in the password for the username in this example it is ‘drupalpass’
5) Enter in a site name I am calling my one ‘Intranet’
6) Site Email address is for whatever email address you want to associate with the site.
7) Type in an administrator name I will keep this straight forward and call it ‘Administrator’
8.) Choose and confirm the password for this user.
9) Choose the time zone you are located in.
10) Uncheck check for updates automatically. (I want it as it is then update it when I want to)
11) Save and continue
12) Then click on ‘your new site’.
Things To do In University Exams
Daljeet Singh Pathania
Friday, April 16, 2010
OSS CAMP, Chandigarh

OSS(open source software) camp was organised in chandigarh on 1oth , April 2010. i got a call from one of the organiser, kunak modi of oss camp for delivering talk on "gillMapping"(open street mapping). from our college me, jagdeep, harbhag, davinder, parveen, anant singh and Amritpal had attended the oss camp.
we all went by bus. I completed my presentation in the morning itself. ;), that's why we reached bit late. :) :)
There were number of good presenter were present. Some of presentation topics were openstreetmapping, Cloud computing, Advance html development tools, joomla , licensing in foss and many other. I guess my presentation went good ;) as per the responses of my friends :) lols.
after presentation i met few more good people present their one was a employ of wipro and other was a student from some other college, they congratulate me for presentation. Lunch was also arranged by oss people. They also provide us cool oss T-shirts and other open source goodies . all arrangements were really well planned.
we left oss camp by 4 pm, then we headed toward sector 17 of chandigarh. we spent some good time their, enjoyed the company of each other, clicked some photographs and at the end of the day we came back. we collected really good memories their, got good inspiration and motivation for our own projects.
Technovision'10


Technovision'10 was a two day technical festival organised in Guru Nanak Dev Engineering college, Ludhiana on 9-10 April,2010. There were number of talks, workshops and events were organised. all committees of college i.e. SCIE , LUG Ludhiana, Computer Club, ISTE ,SAE,ACES and others put their combined efforts to made it success.
I was in the organising team of Technovision'10. I Handel FOSS(Free and Open Source Software) related event. in foss their were three main event first was, talk on foss second was workshop on foss and third was panel discussion.
It was really great.
we have called few experts from the industry, time we had spend with them was really worth mentioning. Name of experts are as following:-
1)Mr. Kishore Bhargawa, CEO,Linkaxis Technology
2)Mr. Mohanty gora, President of IT company
3)Mr. Sudev Brar, President of IT company
4)Mr. Triveni Yadav, Member of Foss community
these people were really great source of inspiration for us. we learn lot many things from them. I got a chance to interact with them and feel really good.
And all over also all event went good. Almost for all branches expert of that field were present. we got nearlly 150 entries from out side the college such as IIT roorkee, colleges from haryana, delhi and punjab .
Sunday, March 21, 2010
Web Designing and Development
Some of the time, the terms "web design" and "web development" are used interchangeably, but the two phrases actually mean two different things. So that you don't get stuck with a service you didn't sign up for, I will go through the two terms and describe them thoroughly.
The Definition of Web Design
Web design typically refers to the process of designing a web site or web page layout and often includes the graphical elements on a page. The design can be developed using a graphics program such as Adobe Photoshop, and provides the framework for the look and feel of a web page.
The finished product of the design does not typically contain code. Rather, the graphical representation of the web page is used by another or the same party as the basis for the code. The representation is divided into areas that can be represented by web code, and other areas that are purely graphics.
Often, web design and development firms use the term "web design" to refer to the entire development of a web site because it is the most commonly recognized term in the marketplace. However, it is important to clarify what a firm means before signing up for their "web design" services.
The Definition of Web Development
Web development is typically used to described the programming required to construct the "back end" of a website. The back end is the area of the site that isn't seen by visitors, but which does the work required in order to present the right information in the correct format to the visitors.
Web development is used to describe any database-driven web designs using dynamic scripting languages like PHP, ASP, ASP.NET and Coldfusion. It also covers database design and development. The term can also be used for client-side scripting such as JavaScript and Java.
Friday, February 26, 2010
"Office Automation"
Our seniors had also tried their hands on this project and they were very close in completion. but, their were some problems in implementation of the project.
I along with my classmate Jagdeep Singh again start working on this project under Dr. H.S.Rai sir's guidance.We started our journey of making project from the collection of previous work done and other details of the project available with Dr. H.S Rai sir. We both were very excited to work on this project .
We were facing the problem in “logging in“ in the software . We were using the database user and password in logging in the project but Rai sir suggest us the write user name and password (i.e. Which stored in the database table).
Now we are able to solve these problem and our project is on 90% worked condition.
Monday, December 7, 2009
check out some links in gilmapping
http://www.gisdevelopment.net/
http://timesofindia.
http://epaper.hindustantimes.
http://www.tribuneindia.com/
http://docs.google.com/View?id=dwzsbzt_60hbsvsxp9
http://www.youtube.com/watch?v=KQHbqhPHK-o&feature=player_embedded
Tuesday, November 24, 2009
Monday, November 23, 2009
experience of the event "gillMapping"
well, the event started at 9:00am in the morning with the opening function in consultancy hall in GNE College, Ludhiana.
various dignitaries were present , many speeches were delivered on GPS Technology, OpenStreetMap and josm software.
I also present my views on the above mention software and also discuss the event with the present people.
after that we have refreshments from college. then we were brief about the event, usage and working of the gps. after that we move to gill village there we notify the various locations,places of interest, streets,roads and many other locations of gill village.
finally we came back to college and using josm software we edit the data and design the final map and uploaded on the openstreetmap.org.
following steps are taken for uploading the map.
1) receive the data from gps on pc by data cable.
2) grim software is needed for saving the gps file in .gpx format.
3) finally open the josm software open the .gpx file in josm then download the map from openstreet. then make amendments in the map and finally upload on the openstreetmap.
hence with the above mention steps your map will be uploaded on the INTERNET.
List of Members
NAME CLASS GROUP
Daljeet Singh Pathania D3 IT L.U.G
Jagdeep Singh Malhi D3IT L.U.G
Aditi Arora D2CSE L.U.G
Akashdeep singh D4 CE A.C.E
Aman Shegal D4 CE A.C.E
Amanpreet Singh D2CSE L.U.G
Amrinder Singh D2IT L.U.G
Ankur Chauhan D2ECE L.U.G
Anurag Chaudry D2CSE L.U.G
biplamdeep singh A.C.E
Chandeep Singh D2CSE L.U.G
Davinder Kumar D2CSE L.U.G
Gurinder Singh D3 IT
Guriqbal Singh D2CSE L.U.G
Gurjyot Singh D2CSE L.U.G
Hargurdeep singh A.C.E
Harkaran singh D2 CE A.C.E
HarmanpreetSingh D1ECE L.U.G
Ismitpal singh D3CE A.V.S
Jaswinder singh D4 CE A.C.E
Mandeep Sngh D3IT
Mokshan abrol D4 CE A.C.E
Parveen Kumar D2IT L.U.G
Pranavanand D2CSE L.U.G
Priyanka Sharma D2IT L.U.G
Sandeep D2PE L.U.G
Shaina D2CSE L.U.G
Simarjeet singh D4 CE A.C.E
Sumit D2ECE L.U.G
Tanpreet singh D4 CE A.C.E
Vikas D2CSE L.U.G
Preeti Jaiin D4CE A.C.E
Gurmeher Singh D2CE
Sunday, November 22, 2009
the parposal of the event "gillmapping"
I was assigned as a project leader for this event . the more detail and experience will be shortly added.
The Department of civil engineering,Guru Nank Dev engineering college,ludhiana is organinsing an event of “gillmapping” on 22/11/2009(Sunday) at 9:00 A.M. For preparing digital map of gill village with the help of nss unit,association of civil engineers &linux user group with following objectives.
(a)To help Govt./NGos for their social welfare schemes. (b)To help our community such as traffic police,cabs etc in track locating. (c)To help physically challenged people(blind) navigate on their own (d)To help grow industrial business in the area of “digital mapping” and to provide scope of placements for students.
We plan to start this project from gill village and thereafter the whole city will be covered. An inaugral function is being planned at Guru Nanak Dev Engineering College on 22/11/09 at 9:00A.M. To mark the start of this project and make everyone aware of it.
Open Street Maps
Open Free maps are Free editable maps.these are made with the help of GPS by anyone at anytime. These maps allows us to view,edit and use geographical data in the callobrative way from anywhere on the globe. Like in some areas, We have some buildings and street being built all the time and with the help of OSM we can always locate this location of sbeakers on the ground and can get up-to-date data.
More important thing is that information is free. It will be owned by the community- not by any big corporate which means it can be accesed by anyone,anytime and anywhere nad can also edit it accordingly. Open street map(OSM) maps are more accurate then anything else on the market in many parts of world depending upon awareness nad participation of community. By using OSM we will come up with new applications and winning innovations around the information we recorded.
Maps prepared by OSM have already Started In US and is new in India. These maps
(a)Help to Grow the industrial business in the area of digital mapping and provided the scope of placements of the students in the same area. (b)Help as track locator to the community such as Traffic Police,Cabs etc. (c)Help as a navigator for the physically challenged people(Blind).
Department of civil engineering at GNDEC Ludhiana is going to prepare such maps. Initially we are starting from Gill Village and Our target is to Prepare maps of ludhiana city. All the data collected by this will be given away free for others to use.
For collecting the data of Gill Village our Students will carry GPS to different part of gill village nad will record the information and then will upload and then this will be provided to the community for the use.
We can get further information regarding open street maps from below link http://news.bbc.co.uk/2hi/technology/8305924.stm http://wiki.openstreetmap.org/wiki
Faculty In charge:-
Er. Rajinder Ghai, Lecturer, Civil Engineering Department, Guru Nanak Dev Engineering College Ludhiana(Pb) India
Er. Harkamaljeet Singh Gill, Lecturer, Civil Engineering Department, Guru Nanak Dev Engineering College Ludhiana(Pb) India
Chairman : - Prof.(Dr.) H.S. Rai HOD,Department of Civil Engineering Guru Nanak Dev Engineering College Ludhiana(Pb) India
upcoming events:- uploading the list of the Mapping Team
posted by:-
Daljeet Singh Pathania
Linux user group(LUG) events in College Genesis
In 20,Nov 2009 our college genesis is begin so Linux User Group (LUG ) conduct two events Workshop on FOSS & LINUX QUIZ . First off all our workshop is begin at 9.00am and Dr. H.S.Rai give Presentation on FOSS .
Introduction to FOSS:- FOSS is an open source software that is being used n linux operating system . A seminar on FOSS was held ,that was presented by Dr. Hardeep Singh Rai. He was presenting many effective information on open source software and systems specially on foss. According to them with the help of these open source softwares and system we can developed a new system that is according to our requirements and needs. Through , the help of the open source softwares we can develop our country in many assepts of information technology.
There was a open discussion on FOSS . Dr.Hardeep Singh Rai and Ajay Shiv Sharma was the in discussion . They were presented their views about these concepts that how to use these open source systems and modify them according to our needs. Also there was a questioner on FOSS and linux operating system. In this module there is question about open source system and the audience presented there was trying to answer these questions and also there was gift on behalf of these questions. We gain knowledge about these open source system a lot.
WORKSHOP ON DRUPAL:- Then, after the seminar on foss ,a workshop on drupal will conducted . In this workshop we work on Drupal (open soure) .Our lecturer Ajay Shiv Sharma was giving a lecture on this that how we work on drupal. He also giving information about DRUPAL which is also an open source software and we make a wonderful website by using drupal. In this module we install Drupal in our machines with some commands that are related to it .We follow the instructions of our lecturer and install it in our machines. Through drupal we develop websites which is very effective and it includes all the content that a website can have. We can learn how to make websites through there systems. There was group of some students that work according to the instructions of lecturer that can handle all this work .
Linux quiz:- At the end of this module of workshop, a quiz on linux and FOSS can de presented . In this quiz questions wiil be asked from the student who attend this whole module of linux. Many of students can participate in this quiz. Special prizes will be given to those students who win this quiz and also those students who work well in work shop any this community .
At end we are deeply thankful to our lecturers Ajay Shiv Sharma and Dr. Hardeep Singh Rai . With the help our teacher we succeeded in our goal of informing students about the open source system.
Monday, November 2, 2009
OSS CAMP in chandigarh

i have attended the oss camp in chandigarh on 24-oct-09, where oss stand for the open source services . It was Unconference on Open Source. this camp was basically promotion of the open source, and various products available in open service.
i have also given presentation on the linux operating system and also introduction LINUX USER GROUP (LUG) .
you can check it out link for oss community :-
http://osscamp.in
Thursday, August 20, 2009
report on core java for two months institutional training
the following report is submitted by me on 2months training:-
name= Daljeet singh pathania
class= pre-final year
branch=Information Technology
topic=core java
college= Guru Nanak Dev Engineering College, ludhiana(p.b)
DOEACC CENTERSRINAGAR/JAMMU
(FORMERLY CEDTI SRINAGAR/JAMMU)
DOEACC is an autonomous body of department of Information Technology, Ministry of Communication & Information Technology, Govt. of India.
DOEACC institute was established in 1983. There are 23 DOEACC institute in all over India. It is one of the most prestigious institutes in India, which offers various computer language courses, certification course, hardware courses and many more in the field of computers.
HISTORY OF JAVA
Java was conceived by james gosling, Patrick Naughton, Chris Warth, Ed Frank and Mike Sheridan at Sun Microsystems, Inc. in 1991.It took 18 months to develop the first working version. This language was initially called “OAK,” but was renamed “java” in 1995.The original impetus for java was not the Internet! Instead, the primary motivation was the need for a platform independent language that could be used to create software to be embedded in various consumer electronic devices.thi s effort ultimately led to creation of java. The emergence of the World Wide Web, java was propelled to the forefront of the computer language design, because the Web too demanded portable programs.
INTRODUCTION TO JAVA
To fully understand java, one must understand the reasons behind its creation, the forces that shaped it, and legacy that it inherits. Like the successful computer language that came before, java is blend of the best elements of its rich heritage combined with the innovative concepts required by its unique mission. Much of the character of the java is inherited from C and C++.From C, java derives its syntax. Many of java’s OOPs features were influenced by C++. Creation of java was deeply rooted in the process of refinement and adaptation that has been occurring in computer programming language for the past several decades.
FEATURES OF JAVA
JAVA APPLETS
An applet is a special kind of java program that is designed to be transmitted over the Internet and automatically executed by a java-compatible web browser. Furthermore, an applet is downloaded on the demand, without further interaction with user. If the user click a link that contain the applet, the applet will automatically downloaded and run in the browser. The creation of the applet changed Internet programming because it expanded the universe of objects that can move about freely in the cyberspace.
Java’s Magic: The Bytecode
The output of the java compiler is not the executable code Rather, it is bytecode. Bytecode is a highly optimized set of instructions designed to be executed by the java run time system, which is called the Java Virtual Machine(JVM). Translating a java program into the bytecode makes it much easier to run a program in a wide variety of environments because only the JVM needs to be implemented for each platform. Although the details of the JVM will differ from platform to platform, all understand the same bytecode.
Servlets: java on the server side
A servlet is a small program that executes on the server. A servlet is a small program that executes on the server. Just as applets dynamically extend the functionality of a web browsers, servlets dynamically extend the functionality of a web server. Thus, with the advent of the servlet, Java spanned both sides of the client/server connection. Servlent are used to create dynamically generated content that is then served to the client. The servlent offers several advantages, including increased performance. Because servlents(like all Java programs) are compiled into bytecode and executed by the JVM, they are highly portable.
Instead of above main features there are several other important features are as following:-
· Simple
· Secure
· Portable
· Object-oriented
· Robust
· Multithreaded
· Architecture-neutral
· Interpreted
· High performance
· Distributed
· Dynamic
The Evolution of java
The initial release of java was nothing short of revolutionary, but it did not mark the end of java’s era of rapid innovation. The java 1.0 was the first release of java. Soon after the release of Java 1.0, the designers of Java had already created Java 1.1.The next major release of Java was Java 2. Where the “2”indicates “second generation.” The creation of Java 2 was watershed event, marking the beginning of Java’s “modern age.” The first release of Java 2 carried the version number 1.2.
Java 2 added support for a number of new features, such as Swing and the Collections Framework, and it enhanced the Java Virtual Machine and various programming tools.
J2SE 1.3 was the first major upgrade to the original Java 2 release. For the most part, it added to existing functionality and “tightened up” the development environment.
The release of J2SE 1.4 further enhanced Java. The release contained several important upgrades, enhancements, and additions. For example, it added the new keyword assert.
The next release of Java was J2SE 5, and it was revolutionary. J2SE 5 fundamentally expanded the scope, power and range of language.
· Generics
· Annotations
· Autoboxing and auto-unboxing
· Enumerations
· Enhanced, for-each style for loop
· Variable-length arguments (varargs)
· Static import
· Formatted I/O
· Concurrency utilities
JAVA SE 6
The newest release of Java is called Java SE 6. With the release of Java SE 6, Sun once again decided to change the name of Java platform. First, notice that the “2” has been dropped. Thus, the platform now has the name Java SE, and the official product name is Java Platform, Standard Edition 6. As with J2SE5, the 6 in the Java SE 6 is the product version number is 1.6.
1# :-> Write a program to illustrate the use of various Data Types of java.
class chap3basics {
public static void main(String[] args)
{
int lightspeed;
long days;
long seconds;
long distance;
lightspeed =186000;
days=1000;
seconds= days*24*60*60;
distance=lightspeed*seconds;
System.out .println("in"+ days+"days light will travel
about"+distance +"miles.");
char ch1,ch2;
ch1=88;
ch2='y';
System.out .println("ch1 $ch2"+ch1+" "+ch2);
ch1++;
System.out .println(ch1);
}
}
The output of the above program is as follows:-
In1000days light will travel about1607040000000miles.
Ch1 $ch2X y
Y
2# :-> Write a program to illustrate the use of boolean Type of java.
class chap3booltest {
public static void main(String[]args)
{
boolean b;
b=false;
System.out.println("b is" +b);
b=true;
System.out .println("b is "+b);
if(b)
System.out .println("this is executed coz b is true");
b= false;
if(b)
System.out .println("this will not executed coz b is false");
System.out .println("10>9"+(10>9));
System.out .println("9>10"+(9>10));
}
}
The out put of the above program is as follow:-
b is false
b is true
this is executed coz b is true
10>9true
9>10false
3# :-> Write a program to illustrate some type conversion that required casts.
class chap3conversion{
public static void main(String[]args){
byte b;
int i=257;
double d=323.134;
{System.out.println("int to byte");
b=(byte) i;
System.out.println("i $ b"+i+" "+b);
System.out.println("double to int");
i= (int) d;
System.out.println("d $ i"+d+" "+i);
System.out.println("double to byte");
b= (byte)d;
System.out.println("d $ b"+d+" "+b);
}
} }
The output of the above program is as follow:-
int to byte
i $ b 257 1
double to int
d $ I 323.134 323
double to byte
d $ b 323.134 67
4# :-> Write a program to illustrate a two-dimensional array in java.
class chap3twodarray{
public static void main(String[]args){
int twodarray[] []=new int[7][7];
int i,j,k=0,l;
for(i=0;i<6;i++)
for(j=0;j<4;j++){
twodarray[i] [j]=k;
k++;}
for(i=0;i<6;i++){
for(j=0;j<4;j++)
System.out.print(twodarray[i] [j]+ "\t ");
System.out.println();
}
}
}
The output of the above program is as follow:-
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
5# :-> Write a program to illustrate the bitwise logical operators.
class chap4bitlogic {
public static void main(String[] args){
String binary[]={"0000" ,"0001","0010","0011","0100","0101","0110","0111","1000",
"1001","1010","1011","1100","1101","1110","1111"};
int a=3, b=6; /** here the values of a and b are not taken from string*/
int c=a|b;
int d=a &b;
int e=a^b;
int f=(~a&b) | (a & ~b);
int g=~a &0x0f;
System.out.println("a="+"\t"+binary[a]);
System.out.println("b="+"\t"+binary[b]);
System.out.println("c="+"\t"+binary[c]);
System.out.println("d="+"\t"+binary[d]);
System.out.println("e="+"\t"+binary[e]);
System.out.println("f="+"\t"+binary[f]);
System.out.println("g="+"\t"+binary[g]);
}
}
The output of the above program is as follows:-
a= 0011
b= 0110
c= 0111
d= 0010
e= 0101
f= 0101
g= 1100
6# :-> Write a program to illustrate the switch statement.
class ch5sampleswitch{
public static void main(String[]args) {
for(int i=0;i<6;i++)
switch(i) {
case 0:
System.out.println("i is=" + i);
break;
case 1:
System.out.println("i is=" + i);
break;
case 2:
System.out.println("i is=" + i);
break;
case 3:
System.out.println("i is=" + i);
break;
default:
System.out.println("i is greater then 3" );
} }
The output of the above program is as follows:-
i is=0
i is=1
i is=2
i is=3
i is greater then 3
i is greater then 3
7# :-> Write a program to illustrate the for-each style for loop in java.
class ch5foreach {
public static void main(String args[] ) {
int num[] = {1,2,3,4,5,6,7,8,9,10 };
int sum=0;
for (int x : num) {
System.out.println("value is="+x);
sum += x;
if(x==5) break;
x= x*10; // this statement will not have any effect on for-each statement
}
System.out.println("summation:"+sum);
}
}
}
The output of the above program is as follows:-
Value is=1
Value is=2
Value is=3
Value is=4
Value is=5
Summation:15
8# :-> Write a program to illustrate the concept of classes with the help of constructor.
class box {
double width;
double height;
double depth;
box() {
width=height=depth=10;
}
box(double w,double h,double d)
{this.width=w;
height=h;
depth=d;
}
double vol(){
return width*height*depth;
}
}
class ch6boxdemo6 {
public static void main(String[] args) {
box mybox=new box(5,6,4);
box mybox2=new box();
System.out.println("the vol is " +mybox.vol());
System.out.println("the vol is " +mybox2.vol());
}
}
The output of the above program is as follows:-
The vol is 120.0
The vol is 1000.0
9# :-> Write a program to illustrate static variables, methods and blocks in java.
class ch7usestatic {
static int a = 3;
static int b;
static void meth(int x){
System.out.println("x=" +x);
System.out.println("a=" +a);
System.out.println("b=" +b);
}
static {
System.out.println("static block initilized" );
b=a*4;
}
public static void main(String[] args) {
meth(42);
}
}
The output of the above program is as follows:-
Static block initialized
X=42
a=3
b=12
10# :-> Write a program to illustrate the variable-length arguments.
class ch7varargs2 {
static void vatest(String msg, int ... v) {
System.out.print(msg+ v.length +"contents:");
for(int x: v)
System.out.print(x+" ");
System.out.println();
}
public static void main(String args[])
{
vatest("one varargs:",10);
vatest("three varargs:",1,2,3);
vatest("no varargs");
}
}
The output of the above program is as follow:-
one vararges :1contents :10
three varargs :3contents :1 2 3
no varargs 0contents:
11# :-> Write a program to illustrate the concept of inheritance using super in java.
class box{
private double width,height,depth;
box(box ob) {
width=ob.width;
height=ob.height;
depth=ob.depth;
}
box(double w,double h,double d) {
width =w;
height=h;
depth=d;
}
box() {
width = -1;
height=-1;
depth=-1;
}
box(double len) {
width=height=depth=len;
}
double volume() {
return width*height*depth;
}
}
class boxweight extends box {
double weight;
boxweight(double w,double h,double d, double m)
{super(w,h,d);
weight =m;
}
boxweight(double h,double m)
{super(h);
weight =m;
}
boxweight()
{super();
weight =-1;
}
boxweight(boxweight ob)
{super(ob);
weight =ob.weight;
}
}
class ch8demoboxweight {
public static void main(String[]args) {
boxweight ob1=new boxweight(10,12,14,19);
boxweight ob2=new boxweight(1,2,3,4);
boxweight ob3=new boxweight();
boxweight ob4=new boxweight(3,4);
boxweight ob5=new boxweight(ob2);
box boxob=new box(4);
double vol;
vol=boxob.volume();
System.out.println(" \nthe volume is:" +vol);
vol=ob1.volume();
System.out.println("\n the volume is:" +vol);
System.out.println(" \nthe weight is:" +ob1.weight);
vol=ob2.volume();
System.out.println("\n the volume is:" +vol);
System.out.println();
boxob=ob2;//a refrence variable of SUPER class can be //assigned a refrence to any SUB class
vol=boxob.volume();
System.out.println(" the volume is:" +vol);
vol=ob3.volume();
System.out.println("\n the volume is:" +vol);
vol=ob4.volume();
System.out.println("\n the volume is:" +vol);
vol=ob5.volume();
System.out.println("\n the volume is:" +vol);
}
}
The output to the above program is as follows:-
the volume is:64.0
the volume is:1680.0
the weight is:19.0
the volume is:6.0
the volume is:6.0
the volume is: -1.0
the volume is:27.0
the volume is:6.0
12# :-> Write a program to illustrate the concept of
Overriding in java.
//method overrriding.
class A {
int i,j;
A (int a, int b) {
i=a;
j=b;
}
//display i and j
void show() {
System.out.println("i and j"+i +j);
}
}
class B extends A{
int k;
B(int a,int b,int c) {
super(a,b);
k=c;
}
// display k-this overrides show() in A
void show() {
System.out.println("k ="+" "+k);
}
}
class ch8override {
public static void main(String[] args) {
B subob =new B(1,2,3);
subob.show();
}
}
The output of the above program is as follows :-
K = 3
13# :-> Write a program to illustrate the concept of
packages in java.
package mypack;
class balance {
String name;
double bal;
balance(String n, double b) {
name =n;
bal =b;
}
void show() {
if(bal<0)
System.out.print("---> ");
System.out.println(name +":$"+bal);
} }
class ch9accountbalance {
public static void main(String args[]) {
balance current[] =new balance[3];
current[0] =new balance("k.j.fielding", 123.23);
current[1] =new balance("will tell", 157.02);
current[2] =new balance("tom jackson", -12.33);
for(int i=0;i<3;i++)
current[i].show();
} }
The output of the above program is as follows:-
k.j.fielding:$123.23
will tell:$157.02
---> tom Jackson:$-12.33
14# :-> Write a program to illustrate the concept of
interfaces in java.
interface callback {
void callback(int param);
}
class client implements callback{
//implements callback interface
public void callback(int p) {
System.out.println("callback called with " +p);
}
}
class ch9testface {
public static void main(String args[]) {
callback c=new client();
c.callback(42);
}
}
The output of the above program is as follow:-
Callback called with 42
15# :-> Write a program to illustrate the concept of
Exception handling in java.
class ch10exc2 {
public static void main(String args[]) {
int d,a;
try{
d=0;
a=42/d;
System.out.println("this will not be printed.");
}
catch(ArithmeticException e) {
System.out.println("division by zero.");
}
System.out.println("after catch statement.");
}
}
The output of the above program is as follows :-
division by zero.
After catch statement.
16# :-> Write a program to illustrate the concept of
Exception handling by using throw keyword in java.
class ch10throwdemo {
static void demoproc() {
try {
throw new NullPointerException("demo");
}
catch(NullPointerException e) {
System.out.println("caught inside demoproc.");
throw e;
}
}
public static void main(String args[]) {
try {
demoproc();
}
catch(NullPointerException e) {
System.out.println("Recaught: "+e);
}
}
}
The output of the above program is as follow :-
Caught inside demoproc.
Recaught: java.lang.NullPointerException: demo
17# :-> Write a program to illustrate the concept of
Multiple threads in java.
//Create multiple threads.
class NewThread implements Runnable {
String name; // name of thread
Thread t ;
NewThread(String threadname) {
name = threadname;
t = new Thread(this, name) ;
System.out.println("New thread: "+ t) ;
t.start () ; // Start the thread
}
// This is the entry point for thread.
public void run () {
try {
for(int i = 5; i > 0; i--) {
System.out. println(name + ": " + i) ;
Thread.sleep(1000) ;
}
} catch (InterruptedException e) {
System.out.println(name + " Interrupted");
}
System.out.println(name + " exiting.");
}
}
class MultiThreadDemo {
public static void main (String args [ ] ) {
new NewThread ("One") ; // start threads
new NewThread ("Two") ;
new NewThread ("Three") ;
try {
// wait for other threads to end
Thread.sleep(10000) ;
} catch (InterruptedException e) {
System.out.println("Main thread Interrupted") ;
}
System.out.println("Main thread exiting.");
}
}
The output from this program is shown here:
New thread: Thread[One, 5,main]
New thread: Thread[Two,5,main]
New thread: Thread[Three,5,main]
One: 5
Two: 5
Three: 5
One: 4
Two: 4
Three: 4
One: 3
Three: 3
Two: 3
One: 2
Three: 2
Two: 2
One: 1
Three: 1
Two: 1
One exiting.
Two exiting.
Three exiting.
Main thread exiting.
18# :-> Write a program to illustrate the concept of enumerated data type in java.
// An enumeration of apple varieties.
enum Apple {
Jonathan, GoldenDel, RedDel, Winesap, Cortland
}
class EnumDemo {
public static void main(String args[ ])
{
Apple ap;
ap= Apple.RedDel;
// Output an enum value.
System.out.println("Value of ap: " + ap);
System.out.println();
ap = Apple.GoldenDel;
// Compare two enum values.
if(ap ==Apple.GoldenDel)
System.out.println("ap contains GoldenDel. \n");
// Use an enum to control a switch statement.
switch(ap) {
case Jonathan:
System.out.println("Jonathan is red .");
break;
case GoldenDel:
System.out.println("Golden Delicious is yellow.");
break;
case RedDel:
System.out.println("Red Delicious is red.");
break;
case Winesap:
System.out.println("Winesap is red.");
break;
case Cortland:
System.out.println("Cortland is red.");
break;
}
}
}
The output of the above program is as follows:-
Value of ap: RedDel
ap contains GoldenDel.
Golden Delicious is yellow.
19# :-> Write a program to illustrate the concept of applet in java.
import java.awt.*;
import java.applet.*;
/*
*/
public class SimpleApplet extends Applet {
public void paint(Graphics g) {
g.drawString(" A Simple Applet" , 200, 20);
}
}
To run the above code a html code is also required which is as follows:-
After running the above to codes the applet run in the window produced by SimpleApplet. The following is the content of the applet.
A Simple Applet
20# :-> Write a program to illustrate the concept of
Generics in java.
//A simple genric class
//here, t is a type parameter that
//will be replace by a real type
// when an object of type gen is created.
class Gen
T ob; // declare an object of type T
// pass the constructor a reference to an object of type T
Gen(T o) {
ob=o;
}
//return ob.
T getob() {
return ob;
}
// show type of T.
void showtype() {
System.out.println("Type of T is " + ob.getClass().getName());
}
}
class ch14gendemo {
public static void main( String[] args) {
// create a Gen reference for the integers.
Gen
/* create s Gen
to iob. notice the use of autoboxing to encapsulate the value
88 within an Integer object.
*/
iob= new Gen
// show the type of data used by iob.
iob.showtype();
//get the value in iob.Notice that no cast is needed
int v=iob.getob();
System.out.println("value:" +v);
System.out.println();
// create a Gen object for strings.
Gen
// show te type of data used by strob.
strob.showtype();
// get the value of strob.Again, notice that no cast is neede.
String str =strob.getob();
System.out.println("value: "+ str);
}
}
The output of the above program is as follows:-
Type of T is java.lang.Integer
Value:88
Type of T is java.Lang.String
Value: Generics Test



