Archive
Archive for January 23, 2009
Java Program to display a simple message “A simple Applet” on the applet window – Q46
January 23, 2009
Leave a comment
Q46: Java Program to display a simple message “A simple Applet” on the applet window.
import java.applet.*;
import java.awt.*;
public class Ap_Simple extends Applet{
public void paint(Graphics g){
g.drawString("Manoj Pandey", 50, 50);
}
}
… from College notes (BCA/MCA assignments):
Categories: Java
Java Applet Programs
Java Program to use all the methods defined by StringBuffer class which are different from String class – Q45
January 23, 2009
Leave a comment
Q45: Java Program to use all the methods defined by StringBuffer class which are different from string class.
class Str_Buffer{
public static void main(String args[]){
StringBuffer sb = new StringBuffer("Hello");
System.out.println("buffer before= " + sb);
System.out.println("charAt(1) before= " + sb.charAt(1));
sb.setCharAt(1, 'i');
sb.setLength(2);
System.out.println("buffer after= " + sb);
System.out.println("charAt(1) after= " + sb.charAt(1));
}
}
… from College notes (BCA/MCA assignments):
Categories: Java
Java String Programs




