2022 Summer Model Answer Paper
2022 Summer Model Answer Paper
Important Instructions to examiners: Example: 4. 4. boolean isFile(): It returns True if the file denoted by the abstract
1) The answers should be examined by key words and not as word-to-word as given in the int y= Math.min(64,45); pathname is a normal file, and False if it is not a normal file.
model answer scheme. System.out.println("File size (bytes) : " + file.isFile());
2) The model answer and the answer written by candidate may vary but the examiner may try ii)Sqrt()
to assess the understanding level of the candidate. Syntax:
static double sqrt(double arg) Returns square root of arg. 5. 5. boolean canRead(): It returns True if the application can read the
3) The language errors such as grammatical, spelling errors should not be given more
Importance (Not applicable for subject English and Communication Skills.
file denoted by the abstract pathname, and returns False otherwise.
Example:
4) While assessing figures, examiner may give credit for principal components indicated in the System.out.println("Is file readable : " + file.canRead());
double y= Math.sqrt(64);
figure. The figures drawn by candidate and model answer may vary. The examiner may give c) Define the interface in Java. 2M
credit for anyequivalent figure drawn. 6. 6. boolean canWrite(): It returns True if the application can modify
Ans. Interface is similar to a class. the file denoted by the abstract pathname, and returns False
5) Credits may be given step wise for numerical problems. In some cases, the assumed
constant values may vary and there may be some difference in the candidate’s answers and
It consist of only abstract methods and final variables. 1M for otherwise.
model answer. To implement an interface a class must define each of the method each point, System.out.println("Is file writeable : " + file.canWrite());
6) In case of some questions credit may be given by judgement on part of examiner of relevant declared in the interface. Any two
answer based on candidate’s understanding. It is used to achieve fully abstraction and multiple inheritance in points 7. 7. boolean canExecute(): It returns True if the application can execute
7) For programming language papers, credit may be given to any other program based on Java. the file denoted by the abstract pathname, and returns False
equivalent concept. d) Enlist any four inbuilt packages in Java. 2M otherwise.
8) As per the policy decision of Maharashtra State Government, teaching in English/Marathi Ans. 1.java.lang ½ M for System.out.println("Is file executable : " + file.canExecute());
and Bilingual (English + Marathi) medium is introduced at first year of AICTE diploma 2.java.util each
Programme from academic year 2021-2022. Hence if the students in first year (first and 3.java.io package
second semesters) write answers in Marathi or bilingual language (English +Marathi), the
f) Write syntax of elipse. 2M
4.java.awt Any four Ans. Syntax: void fillOval(int top, int left, int width, int height) 2M for
Examiner shall consider the same and assess the answer based on matching of concepts 5.java.net packages
with model answer. The filled ellipse is drawn within a bounding rectangle whose upper- correct
6.java.applet left corner is specified by top and left and whose width and height are syntax
Q. Sub Answer Marking e) Explain any two methods of File Class 2M specified by width and height
No Q.N. Scheme Ans.1. 1. boolean createNewFile(): It creates a new, empty file named by 1M for
1. Attempt any FIVE of the following: 10 this abstract pathname automatically, if and only if no file with the each OR
a) Enlist the logical operators in Java. 2M same name exists. method Syntax: void drawOval(int top, int left, int width, int height)
Ans. && : Logical AND 1M each if(file.createNewFile()) Any two The empty ellipse is drawn within a bounding rectangle whose upper-
|| : Logical OR Any two System.out.println("A new file is successfully created."); methods left corner is specified by top and left and whose width and height are
! : Logical NOT operators specified by width and height
2. 2. String getName(): It returns the name of the file or directory
b) Give the syntax and example for the following functions 2M
denoted by the object‟s abstract pathname. g) Enlist any four compile time errors. 2M
i) min ( )
System.out.println("File name : " + file.getName()); Ans. 1)Missing semicolon ½ M for
ii) Sqrt ( )
Ans. i) min() 2)Missing of brackets in classes and methods each error
3. 3. String getParent(): It returns the parent‟s pathname string of the 3)Misspelling of variables and keywords.
Syntax: (Any one of the following) 1M for
object‟s abstract pathname or null if the pathname does not name a 4)Missing double quotes in Strings. Any four
static int min(int x, int y) Returns minimum of x and y each
parent directory. 5)Use of undeclared variable. can be
static long min(long x, long y) Returns minimum of x and y function
System.out.println("Parent name : " + file.getParent()); 6)Incompatible type of assignment/initialization. considered
static float min(float x, float y) Returns minimum of x and y with
static double min(double x, int y) Returns minimum of x and y example 7)Bad reference to object.
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
2. Attempt any THREE of the following: 12 b) Write a Java program to copy the content of one file into another. 4M 3 After creation, an array The size of a Vector can grow or
a) Explain any four features of Java 4M Ans. import java.io.*; 2M for is a fixed-length shrink as needed to accommodate
Ans. 1.Object Oriented: class filecopy correct structure adding and removing items after
In Java, everything is an Object. Java can be easily extended since it 1M for { logic, the Vector has been created
is based on the Object model. each public static void main(String args[]) throws IOException 4 Array can store Vector are store non primitive type
feature { 2M for primitive type data data element.
2.Platform Independent: Any four FileReader fr= new FileReader(“file1.txt"); code element.
features FileWriter fo= new FileWriter("file2.txt"); 5 Declaration of an array Declaration of Vector:
Unlike many other programming languages including C and C++,
int ch; int arr[] = new int [10]; Vector list = new Vector(3)
when Java is compiled, it is not compiled into platform specific
try 6 Array is the static Vector is the dynamic memory
machine, rather into platform independent byte code. This byte code
{ memory allocation. allocation
is distributed over the web and interpreted by the Virtual Machine
while((ch=fr.read())!= -1)
(JVM) on whichever platform it is being run on.
{
fo.write(ch); d) Explain exception handling mechanism w.r.t. try, catch, throw 4M
3.Simple: } and finally.
Java is designed to be easy to learn. If you understand the basic System.out.println(“file copied successfully”); Ans. try: 1M for
concept of OOP Java, it would be easy to master. fr.close(); Program statements that you want to monitor for exceptions are each
fo.close(); contained within a try block. If an exception occurs within the try
4.Secure: } block, it is thrown.
With Java's secure feature it enables to develop virus-free, tamper- finally Syntax:
free systems. Authentication techniques are based on public-key { try
encryption. if(fr!=null) {
fr.close(); // block of code to monitor for errors
5.Architecture-neutral: if(fo!=null) }
Java compiler generates an architecture-neutral object file format, fo.close();
which makes the compiled code executable on many processors, with }}} catch:
the presence of Java runtime system. Your code can catch this exception (using catch) and handle it in some
c) Write the difference between vectors and arrays. (any four 4M rational manner. System-generated exceptions are automatically
6.Multithreaded: points) thrown by the Java runtime system. A catch block immediately
With Java's multithreaded feature it is possible to write programs that Ans. S.No Array Vector 1M for follows the try block. The catch block can have one or more
can perform many tasks simultaneously. This design feature allows 1 An array is a structure The Vector is similar to array holds each point statements that are necessary to process the exception.
the developers to construct interactive applications that can run that holds multiple multiple objects and like an array; Syntax:
smoothly. values of the same it contains components that can be Any four catch (ExceptionType1 exOb)
type. accessed using an integer index. points {
2 An array is a Vectors are heterogeneous. You // exception handler for ExceptionType1
7.Interpreted: Java byte code is translated on the fly to native
homogeneous data type can have objects of different data }
machine instructions and is not stored anywhere. The development
process is more rapid and analytical since the linking is an where it can hold only types inside a Vector.
incremental and light-weight process. objects of one data type
Page 4 / 26 Page 5 / 26 Page 6 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
throw: is implicit public. With this it can be accessed anywhere within 1M for void display()
It is mainly used to throw an instance of user defined exception. the same package. access {
Example: throw new myException(“Invalid number”); assuming 3) protected :The access level of a protected specifier is within the specificatio System.out.println(“In Parent class A”);
myException as a user defined exception package and outside the package through derived class. n table }
4) public :The access level of a public specifier is everywhere. It can }
finally: be accessed from within the class, outside the class, within class B extends A //derived class B from A
finally block is a block that is used to execute important code such as thepackage and outside the package. {
closing connection, stream etc. Java finally block is always executed 5) private protected access: The visibility level is between protected void show()
whether exception is handled or not. Java finally block follows try or access and private access. The fields are visible in all subclasses {
catch block. regardless of what package they are in. System.out.println(“In child class B”);
Syntax: These fiveaccess specifiers can be mapped with four categories in }
finally which packages in java can be managed with access specification public static void main(String args[])
{ matrix as: {
// block of code to be executed before try block ends Access Modifier Public Protected Friendly Private private B b= new B();
Access Location (default) protected
} b.display(); //super class method call
Same Class Yes Yes Yes Yes Yes
3. Attempt any THREE of the following: 12 b.show(); // sub class method call
Sub class in same Yes Yes Yes Yes No
a) Write a Java Program to find out the even numbers from 1 to 100 4M package }
using for loop. Other classes in Yes Yes Yes No No }
Ans. class test same package Note : any other relevant example can be considered.
{ 2M for Sub class in other Yes Yes No Yes No
packages
public static void main(String args[]) Program Multilevel inheritance:
Non sub classes in Yes No No No No
{ logic other packages In multilevel inheritance, a subclass extends from a superclass and
System.out.println("Even numbers from 1 to 100 :"); then the same subclass acts as a superclass for another class.
for(int i=1;i<=100; i++) 2M for Basically it appears as derived from a derived class.
{ program c) Explain single and multilevel inheritance with proper example. 4M
if(i%2==0) syntax Ans. Single level inheritance:
System.out.print(i+" "); In single inheritance, a single subclass extends from a single 1M for
} superclass. each
} explanatio
} n
b) Explain any four visibility controls in Java. 4M
Ans. Four visibility control specifiers in Java are public, default, private
and protected. The visibility control in java can be seen when concept 3M for
of package is used with the java application. Explanatio
1) private :The access level of a private specifier is only within the n 1M for Example:
class. It cannot be accessed from outside the class. each
Example : class A
2) default :When no specifier is used in the declaration, it is called as example
class A {
default specification. Default scope for anything declared in java
{ void display()
Page 7 / 26 Page 8 / 26 Page 9 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
System.out.println(day); {
} 2M for int arr[] ={3,60,35,2,45,320,5};
} diagram System.out.println("Array Before Bubble Sort"); 2M for
Note : any other relevant example can be considered. for(int i=0; i<arr.length; i++) correct
{ syntax
Conditional Operator: System.out.print(arr[i] + " ");
The Conditional Operator is used to select one of two expressions for }
evaluation, which is based on the value of the first operands. It is used 1M for System.out.println();
to handling simple situations in a line. explanatio int n = arr.length;
Syntax: n int temp = 0;
expression1 ? expression2:expression3; Conditiona for(int i=0; i< n; i++)
The above syntax means that if the value given in Expression1 is true, l operator {
then Expression2 will be evaluated; otherwise, expression3 will be New – A new thread begins its life cycle in the new state. It is also for(int j=1; j < (n-i); j++)
evaluated. 1M for referred to as a born thread. This is the state where a thread has been 2M for {
example created, but it has not yet been started. A thread is started by calling explanatio if(arr[j-1] >arr[j])
Example its start() method. n {
class test //swap elements
{ Runnable – The thread is in the runnable state after the invocation of temp = arr[j-1];
public static void main(String[] args) { the start() method, but the scheduler has not selected it to be the arr[j-1] = arr[j];
String result; running thread. It is in the Ready-to-run state by calling the start arr[j] = temp;
int a = 6, b = 12; method and waiting for its turn. }
result = (a==b ? "equal":"Not equal"); }
System.out.println("Both are "+result); Running – When the thread starts executing, then the state is }
} changed to a “running” state. The method invoked is run|(). System.out.println("Array After Bubble Sort");
} for(int i=0; i<arr.length; i++)
Note : any other relevant example can be considered. Blocked–This is the state when the thread is still alive but is currently {
not eligible to run. This state can be implemented by methods such as System.out.print(arr[i] + " ");
b) Draw and explain life cycle of thread. 4M suspend()-resume(), wait()-notify() and sleep(time in ms). }
Ans. Life cycle of thread includes following states : }
1.Newborn Dead – This is the state when the thread is terminated. The thread is }
2. Runnable in a running state and as soon as it is completed processing it is in a
3. Running “dead state”. Once a thread is in this state, the thread cannot even run d) Explain how to create a package and how to import it 4M
4. Blocked again. Ans. To create package following steps can be taken:
5. Dead c) Write a java program to sort an 1-d array in ascending order 4M 1) Start the code by keyword „package‟ followed by package name. 3M
using bubble-sort. Example : package mypackage; for steps to
Ans. public class BubbleSort 2M for 2) Complete the code with all required classes inside the package create
{ correct with appropriate access modifiers.
public static void main(String[] args) logic 3) Compile the code with „javac‟ to get .class file.
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
Example: javac myclass.java to get myclass.class where first fourare x, y, width and height as in case of oval or rect. }
4) Create a folder which is same as package name and make sure 1M to The next two are start angle and sweep angle.When sweep angle is }
that class file of package is present inside it. If not, copy it inside import positive, it moves in anticlockwise direction. It is given as negative, It
this folder. moves in clockwise direction. Example: (Note Any
To import the package inside any other program : other
package package1; similar
Make use of import statement to include package in your program. 5. Attempt any TWO of the following: 12 public class Box
It can be used with „*‟ to gain full access to all classes within package a) How to create user defined package in Java. Explain with an 6M example
{ can be
or just by giving class name if just one class access is required. suitable example. int l= 5; considered
Example : Ans. A java package is a group of similar types of classes, interfaces and 3M int b = 7; )
import mypackage.myclass; sub-packages Package int h = 8;
or It also provides access protection and removes name collisions. creation public void display()
importmypackage.*;
{
e) Explain 4M Creation of user defined package: System.out.println("Volume is:"+(l*b*h));
i) drawLine To create a package a physical folder by the name should be created }
ii) drawOval in the computer. }
iii) drawRect Example: we have to create a package myPack, so we create a folder (Note:
Code Source file:
iv) drawArc d:\myPack import package1.Box;
Ans. i) drawLine(): It is a method from Graphics class and is used to draw 1M for The java program is to be written and saved in the folder myPack. To snippet can class volume {
line between the points(x1, y1) and (x2, y2). each add a program to the package, the first line in the java program be used for
public static void main(String args[])
Syntax : should be package <name>; followed by imports and the program describing) {
drawLine(int x1, int y1, int x2, int y2) logic. Box b=new Box();
b.display();
package myPack; }}
ii) drawOval():Its is a method from Graphics class and is used to import java.util;
draw oval or ellipse and circle. public class Myclass {
b) Write a Java program in which thread A will display the even 6M
Syntax : //code
numbers between 1 to 50 and thread B will display the odd
drawOval(int x, ,int y, int width, int height) }
numbers between 1 to 50. After 3 iterations thread A should go to
It is used to draw oval with the specifiedwidth and height. If width
sleep for 500ms.
and height are given equal, then it draws circle otherwise oval/ellipse. Access user defined package:
iii) drawRect():It is a method from Graphics class and it draws a To access a user defined package, we need to import the package in
Ans. Import java.lang.*;
rectangle with the specified widthand height. our program. Once we have done the import we can create the object
class A extends Thread
Syntax : of the class from the package and thus through the object we can
3M for {
drawRect(int x, int y, int width, int height) access the instance methods. 3M
Example public void run()
iv) drawArc():It is a method from Graphics class and is used to draw import mypack.*; Correct
{
a circular or elliptical arc. public class program
try
Syntax : MyClassExample{ with syntax
{
drawArc(int x, int y, int width, int height, intstartAngle, public static void main(String a[]) {
for(int i=2;i<=50;i=i+2)
intsweepAngle) Myclass c= new Myclass();
{
Page 16 / 26 Page 17 / 26 Page 18 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
System.out.println("\t A thread :"+i); c) What is constructor? List types of constructor. Explain 6M public static void main(String a[]) considered
if(i == 6) // for 3rd iteration 3M parameterized constructor with suitable example. { )
sleep(500); Correct Ans. Constructor: Student s = new Student(20,"ABC"); // constructor
} logic A constructor is a special member which initializes an object 2M for with parameters
} immediately upon creation. Definition s.display();
catch(Exception e) • It has the same name as class name in which it resides and it is }
{ syntactically similar to any method. }
System.out.println("A thread interrupted"); • When a constructor is not defined, java executes a default 6. Attempt any TWO of the following: 12
} constructor which initializes all numeric members to zero and other a) Write a Java Program to count the number of words from a text 6M
} types to null or spaces. file using stream classes. (Note :
} • Once defined, constructor is automatically called immediately after Ans. import java.io.*; Any other
class B extends Thread the object is created before new operator completes. public class FileWordCount { relevant
{ public static void main(String are[]) throws IOException logic shall
public void run() Types of constructors: { be
{ 1. Default constructor File f1 = new File("input.txt"); considered
try 2. Parameterized constructor 1M List int wc=0; )
{ 3. Copy constructor types FileReader fr = new FileReader (f1);
for(int i=1;i<50;i=i+2) 4. Constructor with no arguments or No-Arg Constructor or Non- int c=0;
{ Parameterized constructor. (Any 3 )
System.out.println("\t B thread :"+i); try { while(c!=-1) 3M
} { Correct
} Parameterized constructor: When constructor method is defined c=fr.read(); program
catch(Exception e) with parameters inside it, different value sets can be provided to if(c==(char)' ') with syntax
{ different constructor with the same name. wc++;
System.out.println("B thread interrupted"); }
} Example System.out.println("Number of words :"+(wc+1));
class Student { 3M
} }
int roll_no; Correct
} 1M finally
String name; logic
class OddEven parameteri {
{ Student(int r, String n) // parameterized constructor if(fr!=null)
{ zed
public static void main(String args[]) constructor fr.close();
{ roll_no = r; }
new A().start(); name=n; }
} 2M
new B().start(); Example }
} void display()
b) Explain the difference between string class and string buffer 6M
} {
(Any Other class.
System.out.println("Roll no is: "+roll_no);
Example Explain any four methods of string class
System.out.println("Name is : "+name);
Can be
}
Page 19 / 26 Page 20 / 26 Page 21 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
Ans. 1M each Output:Sachin beginning index, upto, but not including, the ending index.
Any 2 4)replace ():Returns a new string resulting from replacing all Example :
points occurrences of old Char in this string with new Char. System.out.println(("Welcome”.substring(3,5));//co
Syntax: s1.replace(‘x’,’y’)
Example: String s1="Java is a programming language. Java is a 8. compareTo():
platform."; Syntax: int compareTo(Object o) or int compareTo(String
String s2=s1.replace("Java","Kava"); //replaces all occurrences of anotherString)
"Java" to "Kava" System.out.println(s2); There are two variants of this method. First method compares this
Output: Kava is a programming language. Kava is a platform String to another Object and second method compares two strings
5. length(): lexicographically.
Syntax: int length() Example. String str1 = "Strings are immutable";
1M each
Methods of string class Any 4 It is used to return length of given string in integer. String str2 = "Strings are immutable";
1)toLowercase (): Methods Eg. String str=”INDIA” String str3 = "Integers are not immutable";
Converts all of the characters in this String to lower case. correct System.out.println(str.length()); // Returns 5 int result = str1.compareTo( str2 );
Syntax: s1.toLowerCase() explanatio 6. charAt(): System.out.println(result);
Example: String s="Sachin"; n Syntax: char charAt(int position) result = str2.compareTo( str3 );
System.out.println(s.toLowerCase()); The charAt() will obtain a character from specified position . System.out.println(result);
Output: sachin Eg. String s=”INDIA”
System.out.println(s.charAt(2) ); // returns D
c) Write a Java applet to draw a bar chart for the following values. 6M
2) toUppercase(): 7. substring():
Converts all of the characters in this String to upper case Syntax:
Syntax: s1.toUpperCase() String substring (int startindex)
Ans. import java.awt.*;
Example: String s="Sachin"; startindex specifies the index at which the substring will begin.It will
import java.applet.*; 2M for
System.out.println(s.toUpperCase()); returns a copy of the substring that begins at startindex and runs to the
Output: SACHIN end of the invoking string Applet tag
/* <applet code=BarChart width=400 height=400>
3)trim (): Example: <param name=c1 value=110>
Returns a copy of the string, with leading and trailing whitespace System.out.println(("Welcome”.substring(3)); //come <param name=c2 value=120>
omitted. (OR) <param name=c3 value=170>
Syntax: s1.trim() String substring(int startindex,int endindex) <param name=c4 value=160>
<param name=label1 value=2011>
Example: String s=" Sachin "; Here startindex specifies the beginning index, and endindex specifies
<param name=label2 value=2012>
System.out.println(s.trim()); the stopping point. The string returned all the characters from the <param name=label3 value=2013> 2M for
Page 22 / 26 Page 23 / 26 Page 24 / 26
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous) (Autonomous)
(ISO/IEC - 27001 - 2005 Certified) (ISO/IEC - 27001 - 2005 Certified)
setBackground(Color.yellow);
try {
int n = Integer.parseInt(getParameter("Columns"));
label = new String[n];
value = new int[n];
label[0] = getParameter("label1");
label[1] = getParameter("label2");
label[2] = getParameter("label3");
label[3] = getParameter("label4");
value[0] = Integer.parseInt(getParameter("c1"));
value[1] = Integer.parseInt(getParameter("c2"));
value[2] = Integer.parseInt(getParameter("c3"));
value[3] = Integer.parseInt(getParameter("c4"));
}
catch(NumberFormatException e){}
}
public void paint(Graphics g)
{
for(int i=0;i<4;i++) {
g.setColor(Color.black);
g.drawString(label[i],20,i*50+30);
g.setColor(Color.red);
g.fillRect(50,i*50+10,value[i],40);
}
Page 25 / 26 Page 26 / 26