Apr

08

JSP SAMPLE CODES DOWNLOAD

 

Nov

03

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent1.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent1 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
public void mouseExited(MouseEvent e){
System.out.println(“mouseExited”);
}
public void mouseEntered(MouseEvent e){
System.out.println(“mouseEntered”);
}
public void mouseReleased(MouseEvent e){
System.out.println(“mouseReleased”);
}
public void mousePressed(MouseEvent e){
System.out.println(“mousePressed”);
}
public void mouseClicked(MouseEvent e){
System.out.println(“mouseClicked”);
}
}

 

//—————————————————————————————-

 

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent2.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent2 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
String msg=””;
public void mouseExited(MouseEvent e){
msg=”MouseExited”;
repaint();
}
public void mouseEntered(MouseEvent e){
msg=”MouseEntered”;
repaint();
}
public void mouseReleased(MouseEvent e){
msg=”MouseReleased”;
repaint();
}
public void mousePressed(MouseEvent e){
msg=”MousePressed”;
repaint();
}
public void mouseClicked(MouseEvent e){
msg=”MouseClicked”;
repaint();
}
public void paint(Graphics g){
g.drawString(msg,100,100);
}
}

 

//———————————————————————————-

 

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code=”MyAppEvent3.class” width=”400″ height=”400″>
</applet>
*/
public class MyAppEvent3 extends Applet implements MouseListener{
public void init(){
addMouseListener(this);
}
String msg=””;
public void mouseExited(MouseEvent e){
msg=”MouseExited”;
repaint();
}
public void mouseEntered(MouseEvent e){
msg=”MouseEntered”;
repaint();
}
public void mouseReleased(MouseEvent e){
msg=”MouseReleased”;
repaint();
}
public void mousePressed(MouseEvent e){
msg=”MousePressed”;
repaint();
}
int x=40,y=40;
public void mouseClicked(MouseEvent e){
x=e.getX();
y=e.getY();
msg=”MouseClicked”;
repaint();
}
public void paint(Graphics g){
showStatus(x+”,”+y);
g.drawString(msg,x,y);
}
}

 

Nov

03

import java.applet.*;
import java.awt.*;
/*
<applet code=”App6.class” width=”550″ height=”350″>
</applet>
*/
public class App6 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(88,200,0));
}
int x=20;
int flag=0;
public void paint(Graphics g){
if(x==20)
flag=0;
if(x>=500)
flag=1;
if(flag==0)
x=x+5;
if(flag==1)
x=x-5;
g.fillOval(x,20,40,40);
try{
Thread.sleep(200);
}catch(InterruptedException e){
}
repaint();
}
}

 

//——————————————————————–

 

import java.applet.*;
import java.awt.*;
/*
<applet code=”App5.class” width=”350″ height=”350″>
</applet>
*/
public class App5 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(88,200,0));
}
public void paint(Graphics g){
g.setColor(Color.green);
g.fillOval(100,100,70,70);
try{
Thread.sleep(500);
}catch(InterruptedException e){
}
g.setColor(Color.yellow);
g.fillOval(100,100,70,70);
try{
Thread.sleep(500);
}catch(InterruptedException e){
}
repaint();
}
}

 

//————————————————————————

 

import java.applet.*;
import java.awt.*;
/*
<applet code=”App4.class” width=”350″ height=”350″>
</applet>
*/
public class App4 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(88,200,0));
}
int flg=0;
int w=20,h=20,x=100,y=100;
public void paint(Graphics g){
g.fillOval(x,y,h,w);
if(h==100)
flg=1;
if(h==20)
flg=0;
if(flg==0){
h=h+5;
w=w+5;
x=x-1;
y=y-1;
}
if(flg==1){
h=h-5;
w=w-5;
x=x+1;
y=y+1;
}
try{
Thread.sleep(500);
}catch(InterruptedException e){
}
repaint();
}
}

 

//——————————————————————–

 

import java.applet.*;
import java.awt.*;
/*
<applet code=”App3.class” width=”350″ height=”350″>
</applet>
*/
public class App3 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(88,200,0));
}
int w=20,h=20,x=100,y=100;
public void paint(Graphics g){
g.fillOval(x,y,h,w);
h=h+5;
w=w+5;
x=x-1;
y=y-1;
try{
Thread.sleep(500);
}catch(InterruptedException e){
}
repaint();
}
}

 

 

Oct

29

import java.applet.*;
import java.awt.*;
/*
<applet code=”App2.class” width=”250″ height=”250″>
</applet>
*/
public class App2 extends Applet{
public void init(){
setBackground(Color.yellow);
setForeground(new Color(88,200,0));
}
public void paint(Graphics g){
g.setFont(new Font(“Comic sans ms”,Font.BOLD,30));
g.drawString(“HELLLO”,40,40);
g.setFont(new Font(“Verdana”,Font.BOLD,30));
g.drawString(“HELLLO”,40,80);
g.drawLine(20,120,150,120);
g.drawOval(20,130,150,120);
g.fillOval(60,170,20,20);
g.fillOval(120,170,20,20);
g.drawLine(90,180,90,210);
g.fillOval(100,220,70,20);
}
}

Oct

29

import java.applet.*;
import java.awt.*;
/*


*/
public class App1 extends Applet{
public void init(){
System.out.println(“void init()”);
}
public void start(){
System.out.println(“void start()”);
}
public void stop(){
System.out.println(“void stop()”);
}
public void destroy(){
System.out.println(“void destroy()”);
}
public void paint(Graphics g){
System.out.println(“void paint(Graphics g)”);
}
}

Sep

26

Program to create user defined java package Click to download

 

Sep

19

Basics to Inheritance Java Programs CLICK TO DOWNLOAD

Aug

12

Program-1

class Arr1{
public static void main(String r[]){
/*int num[]=new int[5];
num[0]=10;
num[1]=20;
num[2]=30;
num[3]=40;
num[4]=50;*/
int num[]={10,20,30,44,55,66};
System.out.println(“Array length is: “+num.length);
for(int i=0;i<num.length;i++){
System.out.println(num[i]);
}
/*System.out.println(num[0]);
System.out.println(num[1]);
System.out.println(num[2]);
System.out.println(num[3]);
System.out.println(num[4]);*/
}
}

Program-2

import java.io.*;
class Arr2{
public static void main(String r[]){
int num[]=new int[5];
Console c=System.console();
for(int i=0;i<num.length;i++){
String s=c.readLine(“Enter a number: “);
num[i]=Integer.parseInt(s);
}
int sum=0;
for(int i=0;i<num.length;i++){
System.out.println(num[i]);
sum=sum+num[i];
}
System.out.println(sum);
}
}

Program-3

import java.io.*;
class Arr3{
public static void main(String r[]){
int num[]=new int[5];
Console c=System.console();
for(int i=0;i<num.length;i++){
String s=c.readLine(“Enter a number: “);
num[i]=Integer.parseInt(s);
}
int min,max;
min=max=num[0];
for(int i=1;i<num.length;i++){ if(min>num[i])
min=num[i];
if(max<num[i])
max=num[i];
}
System.out.println(“Smallest Value is: “+min);
System.out.println(“Greatest Value is: “+max);
}
}

Filled Under: Java (Core)

Jul

20

CodeVita - A Perfect Launchpad for Coders

CodeVita – A Perfect Launchpad for Coders by TCS

  • Contest is open for students from all institutes, disciplines and batches(1st-4th year) of engineering.
  • The students can register for the contest irrespective of any eligibility criteria. To register, visit Campus Commune link on https://nextstep.tcs.com(register as off campus applicant)
  • In case, during registration, the student does not find the name of the institute, they can select – “Others” option and then fill the institute name.
  • Final round will be held at one of the TCS facilities. Exciting prizes to be won, On the spot offers, on the spot Internship offers may come as a surprise element.
  • This time, the students will be competing with institutes from all across the globe, wherever TCS has it’s centers. The last date for registrations is 23rd July,14.

 

Apr

19

TECH MARATHON - A 24 HRS TECHNO BRAIN RACE

TECH MARATHON – A 24 HRS TECHNO BRAIN RACE

Apr

19

TECH MARATHON - A 24 HRS TECHNO BRAIN RACE

TECH MARATHON – A 24 HRS TECHNO BRAIN RACE

Apr

04

      1. Write a ‘C’ program to find the smallest and biggest value in a single dimensional array using array and pointer concepts.
      2. write a C program using pointer to sort the given list of numbers in ascending order.

Apr

04

//———————————————— arp2.c ———————————–

// find the sum of array elements using pointer

#include<stdio.h>
void main(){
int a[5];
int *ptr;
int i,sum=0;
printf(“Enter Five Numbers:\n”);
for(i=0;i<5;i++){
scanf( “%d”,&a[i]);
}
ptr=a;
for(i=0;i<5;i++){
sum=sum+*(ptr+i);
}
printf(“Addition is: %d\n”,sum);
}