Define a class to declare an array of size 20 of the double datatype, accept the elements into the array and perform the following: Calculate and print the sum of all the elements.

Define a class to declare an array of size 20 of the double datatype, accept the elements into the array and perform the following: Calculate … Read more

Define a class to declare an integer array of size n and accept the elements into the array.

import java.util.Scanner;class LinearSearch{public static void main(String args[]){int c, n, search, array[];Scanner in = new Scanner(System.in);System.out.println(“Enter number of elements”);n = in.nextlnt();array= new int[n];System.out.println(“Enter those” +n+ “elements”);for … Read more

Java program Applet image display

APPLET IMAGE DISPLAY: import java.awt.*; import java.applet.*;     public class AppletDisplayImage extends Applet {  Image picture;  public void init() { picture = getImage (getDocumentBase(), http://nebula.wsimg.com/a418036bd85efa32bdb96f5dbb77e203?AccessKeyId=F7C1E0F1DEF38C4D96C2&disposition=0&alloworigin=1 … Read more

Java program Applet mouse event handling

APPLET MOUSE EVENT: import java.awt.*; import java.awt.event.*; import java.applet.*; public class MouseApplet extends Applet implements MouseMotionListener{         public void init(){                     addMouseMotionListener(this);                     setBackground(Color.WHITE);                     … Read more

Javaprogram Graphic Applets

APPLET GRAPHICS: import java.applet.Applet; import java.awt.*; public class Graphic extends Applet{ public void paint(Graphics g){ g.setColor(Color.yellow); g.fillRect(0,0,200,30); g.setColor(Color.black); g.drawString(“Namashkar”,50, 50); g.setColor(Color.red); g.drawLine(200,30,200,300); g.setColor(Color.green); g.drawOval(0,100,200,30); g.setColor(Color.gray); … Read more