Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Give two appropriate advantages of using in-built methods over creating user defined methods.

Answer»

They are well tested and optimized.

They run faster as they are pre-compiled.

52.

What will be the contents of Str1 and Str2 after the following code is executed?String Str2,Str1;Str1 = "Dear Friend";Str2 = "Hello";Str1 = Str2.concat(Str1)

Answer»

Str1 - HelloDear Friend

Str2 - Hello

53.

Ms. Meena is not able to understand the statement "Java is a case sensitive language". Help her in understanding the above mentioned statement by giving suitable example.

Answer»

Java is a case sensitive language as Java distinguish between uppercase and lowercase very strictly. For example:

int t num1, num1;

Although both variables have same name in the above statement but java will treat them two different variables due to first character in different case.

54.

Shalini is learning Java programming language, as it allows developers to write code that can run on any machine, regard less or architecture or platform. Help her in finding solutions of her problems :(i) She wants to compare two integer values for equality in her java code. Out of (=) and (= =), which operator she should use and why?(ii) Help her in writing Java code to initialize two integer variables named num1 and num2 with values 5 and 10 respectively. Increase the value of num 1 by 5 and decrease the value of num2 by 5.

Answer»

(i) == operator

As = operator is assignment operator which will be used to assign the values to any variable/ constant white = = is comparison operator. It check for equality.

(ii) int num1 = 5, num2 = 10;

num1 = num1+ 5;

num2 = num2- 5;

55.

How one can make a Text Field un-editable on a Frame?

Answer»

<JTextField>.setEditable(false);

56.

(a) Name one Entry Controlled loop.(b) What is the difference between set Enabled ( ) and set Editable ( ) methods?(c) Identify invalid variable name(s) out of the following. State reason if invalid:(i) while(ii) 123 salary(iii) big(iv) product

Answer»

(a) For loop

(b) The setEnabled (true) enables a component for use, and setEnabled (false) disables it. SetEditable method prevents users from changing a field.

(c) (i) - Keyword.

(ii) - can't start with number.

57.

Given a string object namely 'subject', having value as "123" stored in it. What will be result of the following : JOptionpane.showMessageDialog(null," "+(subject.length() +Integer.parseInt(subject)));

Answer»

The correct answer:

126

58.

Given a String object named 'code' having value as "908" stored in it. What will be result of the following?JOptionPane.showMessageDialog(null, " " + (code.length( ) + Integer.parseInt(code)));

Answer»

The correct output

911

59.

Explain the following terms : (i) IDE(ii) Inspector Window(iii) Form

Answer»

(i) IDE : IDE is an acronym for Integrated Development Environment which is a work environment that integrates all tools necessary for Application Development and makes them available as part of one environment.

(ii) Inspector Window : It provides a hierarchical tree view of various components. Each form is represented by a root node within which all components in the form's class are contained. 

(iii) Form : Forms are used to accept data (input) and submit data to an external agent for processing.

60.

Differentiate between TextField and passwordField.

Answer»

The TextField displays the obtained text in unencrypted form whereas password field displays the obtained text in encrypted form. This component allows confidential input like passwords which are single line.

61.

What will be displayed in jTbxtField1 and jTextField2 after the following code is executed:jTextField1.setText( num + num1 + " ") ;jTextField1.setText( " " + num + num1) ;

Answer»

jTextField1 as 81 will be displayed jTextField2 as 3546 will be displayed.

62.

What will be displayed in jTextArea 1 after the following code is executed:int i;for(i = 10; i&lt;50; i= i + 30){i = j + 15;jTextArea1.append(" " + i);}jTextArea1.append("/n" +i);

Answer»

After executed

output:

25

63.

Do as directed :I. Find the output of the following Java code snippet after execution of each Java statement labelled as Stmt 1, Stmt 2, Stmt 3, Stmt 4;String str1 = "VASUDHAIVA", str2 = "KUTUMBAKAM";jTextArea1.append((str1.substring(0, 4)));//Stmt1jTextArea1.append((str2.substring(4))); / /Stmt2jTextArea1.setText(jTextArea1.getText() +jTextArea l.getText().length() );/ /Stmt3jOptionPanel.showMessageDialog(null,jTextArea1.getText().length()); //Stmt 4II. Rewrite the following code using do while loop :int num = Integer.parseInt(TextField1.getText());while(num&lt;=40){jOptionPane1.showMessageDalog(null,num);num=num*20;}jOptionPane1.showMessageDialog(null, "Bye Bye");

Answer»

I.  VASU

VASUMBAKAM

VASUMBAKAM10

12

II. int num=Integer.parseInt(jTextField1.getText());

do

{

jOptionPane1.showMessageDialog(null,num);

num=num*20;

} while(num<=40);

jOptionPane1.showMessageDialog(null,"Bye Bye");

64.

Mr. Rangaswami works at a Recreation Park as a system analyst. He has created the following GUI. When a group arrives at the Recreation Park, the number of people in the group and whether the group wants to enjoy the Water Park or not is entered. Entry fee is Rs 500 per person. The person can choose to play at Water park by selecting the checkbox. Rides of Water Park will cost Rs 250 extra per person.Help him to write code for the following : (i) On the click of 'Calculate' button, textfield for 'Entry Fees' should display (Entry Fees per person) x (number of people). If 'Water Park' check box is selected, textfield for 'Water Park charges' should display Water (Park Charges per Person) x (Number of People). TextField for 'total Amount' should display sum of Entry Fees and Water Park charges for all the people in the group.(ii) Write Java code to clear all Textboxes on the click of 'Clear' Button.(iii) Write Java code to close the application on the click of 'Exit' Button.

Answer»

(i) int wfee = 0, tfee = 0;

int nop = Integer.parseInt(JTextField1.getText());

int efee = nop * 500;

if(jCheckBox1.isSelected())

wfee = nop * 500;

tfee = efee * wfee;

j TextField2. setText(" " + efee);

jTextField3.setText("" + wfee);

jTextField4.se tText(" " + tfee);

(ii) JTextField1.setText(" ");

JTextField2.setText(" ") ;

JTextField3.setText(" ") ;

JTextField4.setText(" ") ;

(iii) System.exit(0);

65.

Ms. Rakhi works in an International Bank as an IT Head. She designed a simple interest calculator program as shown below:The interest rate is given based on the account type as shown below :Account Typelnterest Rate %Saying4%Recurring Depowity6%Fixed Deposite8%(i) Write the code required for 'INTEREST RATE' button to display interest rate as per the above given criteria.(ii) Write the code required for 'SI' button to calculate and display 'simple Interest' based on the given formula' SI = (amount*interestrate* duration)/100;(iii) Write the code required for 'CLEAR ALL to clear all the textfields.

Answer»

(i) Correct code required for 'INTEREST RATE' button to display interest rate as per the above given criteria:

if (R1.isSelected() = = true)

T3.setText(" 4");

else if(R2.isSelected() = = true)

T3.setText("6");

if(R3.isSelected() = =true)

T3.setText("8");

(ii) Correct code required for 'SI' button

double amt = Double.parseDouble(T2.getText());

double int_rate =Double.parseDouble(T3.getText());

int year = Integer.parseInt(T4.getText());

double si = (amt*int_rate*year)/100;

T5.setText(" " + si);

(iii) t1.setText(" ");

t2.setText(" ");

t3.setText(" ");

t4.setText(" ");

t5.setText(" ");

66.

XYZ Pens Company sells each pen at the cost of &lt; 25.00. The programmer has developed a GUI application as shown below:(i) The number of pens bought are entered by the user.(ii) The Amount is Number of Pens * 25.00(iii) If a person buying pens is a 'Special Customer', a discount of 5% is given on the amount, otherwise no discount is given.(iv) Amount to be paid = Amount - DiscountWrite code in Java to do the following:(i) When Calculate button is clicked the Amount, Discount and Amount to be Paid are calculated and should be displayed in appropriate text fields.(ii) When Clear button is clicked, all the Textfields and Checkbox are cleared.(iii) When Stop button is clicked, the application is closed.

Answer»

(i) float amt, discount = 0.0;

int n = Integer.parselnt(TextNoofpens.getText());

amt = n * 25;

If (jSpeicalCustomer.isSelected() = = True)

{

discount = amt + 0.05;

amt = amt - discount;

}

jTextDiscount.setText(discount.toString());

jAmount.setText(amt.toString());

(ii) jNoofpens.setText(" ");

jTextDiscount.setText(" ");

jAmount.setText(" ");

jSpecialCustomer.setSelected(False);

(iii) System.exit(0);

67.

Vijay has developed a software for planning personal budget. A screenshot of the same is shown below:Total Income, Expenses of Bills (Water/Electricity), Groceries, Entertainment, other expenses and whether money is to be sent to Hostel are entered by the user. Sum of Expenses, Grand Total of Expenses and Savings are calculated and displayed by the program. Write the code to do the following:(i) When 'CALCULATE' button is clicked, Sum of Expenses, Total Expenses and Savings should be calculated and displayed in appropriate text fields.(a) Sum of Expenses is calculated by adding expenses on Bills (water/Electricity), Groceries, Entertainment and other expenses.(b) Grand total of Expenses is calculated according to the following criteria :If 'Money to be sent to Hostel' checkbox is selected, 3000.00 is to be added to the sum of expenses. If it is not selected, Grand Total of Expenses is the same as sum of expenses.(c) Savings = Total Income - Grand Total of Expenses.(ii) When 'CLEAR' button is clicked, all text fields and checkbox should be cleared.(iii) When 'CLOSE' button is clicked, the application should close.

Answer»

(i) float bill = Float.ParseFloat(txt Bill.getText()) ;

float groc = Float.ParseFloat(txt Groceries.getText()) ;

float enter = Float.ParseFloat(txt Entertainment.getText ( ) ) ;

float other = Float.ParseFloat(txtother.getText());

float sum = bill+groc+enter+other;

txtsumofExpenses.SetText(Float.tostring(sum) ) ;

if(chkMoney.isselected( ))

sum = sum + 3000.00;

txtGrand.setText(Float.tostring( sum));

float income=Float.parseFloat(txtIncome.getText()) ;

float saving= income- sum;

txtsavings.setText(Float.tostring( savings));

(ii) txtincome.setText (" ");

txtBill.setText(" ");

txtGroceries.setText (" ") ;

txtEntertainment.setText (" ") ;

txtother.setText (" ") ;

txtsumofExpenses.setText (" ") ;

txtBrand.setText ( " ") ;

txtsavings.setText (" ") ;

ChkMoney.Setselected(false) ;

(iii) System exit(0);

68.

Mr. Radhey Shyam Bansal the owner of the Kiddi Land Enterprise has asked his programmer Ekta to develop the following GUI in Netbeans.Mr. Bansal accepts payment through three types of credit cards. The discount is given according to the following scheme:Type of CardDiscountPlatinum20% of amountGold15% of amountSilver10% of amountIf the bill amount is more than Rs. 25,000/- then the customer gets an additional offer of 5%. Write Java code for the following:(i) To assign Additional Discount as 0 (jTextField4) and Net amount as 0 (jTextField5). Also set them as un-editable. [When "Calculate Discount" (jButton1) is clicked](ii) To calculate discount as per the given criteria and display the same in jTextField3 To assign Additional Discount (jTextField4) as 5% of amount (jTextField2) as per the above condition. (iii) To enable "Calculate Net Amount" (jButton2) button [When "Calculate Net Amount" (jButton2) button is clicked] To calculate net amount as [TotalCost (jText- Field2)- Discount (jTextField3) -Additional Discount (jTextFielda)]To display the net amount in jTextField5.

Answer»

(i) jTextField4.setText("0");

jTextField5.setText("0");

jTextField4.setEditable(false);

jTextField5.setEditable(false);

(ii) double discount = 0.0 ;

double billAmount = Double.

parseDouble(jTextField2.getText());

if(jRadioButton1.isSelected())

discount = 0.20;

if(jRadioButton2.isSelected())

discount = 0.15;

if(jRadioButton3.isSelected())

discount = 0.10;

jTertField3.setText(billAmount * discount + " ")

if (billAmount > 25000)

jTextField4.setText(billAmount * 0.05+ " ");

jButton2.setEnabled(true);

(iii) doube netAmount = Double.

parseDouble(jTextField2.getText()) - Double.

parseDouble(jTextField3.getText()) -Double.

parseDouble(jTextField4.getText());

jTextField5.setText(netAmount + " ");

69.

Seema is a junior Programmer at 'Avon Shoe Factory'. She has created the following GUI in Netbeans.(i) Items namely Shoes, Sandals and Slippers are manufactured by the factory. (ii) A buyer can buy more than one item at a time. (iii) Each pair of shoes costs Rs1,500.00, each pair of sandals costs Rs1,000.00 and each pair of slippers cost Rs 500.00. (iv) The item bought will be selected by the user and the Quantity (number of pairs) bought will be entered by the user. (v) Amount to be paid for that item will be displayed in front of the item. For example if 'Shoe' is selected and quantity entered is 20, then Amount should be displayed as 30000. Help Seema to write code for the following:(i) When 'Calculate' button is clicked, the amount should be displayed in front of each item (in the appropriate textfield) and Total amount (sum total of all the amounts) should be displayed in the appropriate textfield. (ii) When Clear button is clicked, all the Textfields and Checkboxes should be cleared. (iii) When Stop button is clicked, the application should close.

Answer»

(i) float qty1 = 0, qty2 = 0, qty3 = 0,amt1 = 0,amt2 = 0 ,amt3 = 0,total;

if (jCheckBox1.isSelected())

qty1 = Float.parseFloat(jTextField1.getText());

if (jCheckBox2.isSelected())

qty2 = Float.parseFloat(jTextField2.getText());

if ( CheckBox3.isSelected())

qty3 = Float.parseFloat(jTextField3.getText());

amt1 = qty1 * 1500;

amt = qty2 * 1000;

amt = qty3 * 500;

total = amt1 + amt2 + amt3;

jTextField4.setText(" " + amt1);

jTextField5.setText(" " + amt2);

jTextField6.setText(" " + amt3);

jTextField7.setText(" " + total);

(ii) jTextField1.setText(" ");

jTextField2.setText(" ") ;

jTextField3.setText(" ") ;

jCheckBox1.setSelected(false);

(iii) System.exit(0);

70.

Janav Raj is programmer at Path Educo Enterprises. He created the following GUI in NetBeans. HeIp him to write code for the following :(i) To display series of odd or even numbers (depending on Starting Number - jTextField1 is even or odd) in the jTextArea on the click of command button [Display the Series]. For example: If the start number is 5 and last number is 11 TextArea content will be 57911 If the start number is 2 and last number is 10 TextArea content will be 246810 (ii) To clear both the text fields and text area, on clicking [reset button.] (iii) To terminate the application on the click [Stop button]. (assume suitable name for the various controls on the form)

Answer»

(i) int s = Integer.parseInt(jTextField1.getText().trim());

int e = Integer.parseInt(TextField2.getText().trim());

while (s <= e)

{

jTextArea1.append(" " + s +" ");

S+ = 2;

}

(ii) jTextField1.setText(" ");

jTextField2.setText(" ") ;

jTextField3.setText(" ");

(iii) System.exit (0);

System.exit ( );

71.

Aditya is a programmer at Edudel enterprises. He created the following GUI in NetBeans.Help him to write code in Java for the following:(i) To calculate Total marks obtained and display in jTextField4 on the click of command button "Get Total".(ii) To calculate Grade obtained and display in jTextField5 on the click of command button "Get Grade". Criteria for Grade calculation is given below:MarksGradeAbove 80AAbove 50 and &lt; = 55BAbove 50 and &lt; = 65C&lt; = 50D(iii) To stop execution and exit from the application on the click of command button "Exit".

Answer»

(i) private void jButton1ActionPerf ormed(java.awt.event.ActionEvent evt)

int a = Integer.parseInt(jTextField1.getText());

int b = Integer.parseInt(jTextField2.getText());

int c = Integer.parseInt(jTextField3.getText());

int total = a + b + c;

jTextField4.setText(Integer.toString(total));

}

(ii) private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)

int t = Integer.parseInt(jTextField4.getText());

int a = t/3;

if(a >=80)

{ jTertField5.setText("A");

else if(a>55 && a<=55)

{ j TextField5. setText("B");

}

else if(a>50 && a<=65)

{ jTextField5.setText("C");

}

else if(a< =50)

{ jTextField5.setText("D");

}

}

(iii) privatevoidjButton3ActionPerformed(java.awt.event.ActionEvent evt)

{

System.exit(0);

}

72.

Albert works as a website developer in Global Website Designer company. Currently he has created following tags in XML: &lt;STUDENT&gt;...&lt;/STUDENT&gt; &lt;Student&gt;.... &lt;/Student&gt; Are these tags part of HTML code or XML code? Are these same or different?

Answer»

These tags are part of XML code.

These tags are different.

73.

Name two attributes of FONT tag of HTML.

Answer»

1. Size

2. Face

3. Color

74.

Identify the error in the following HTML code. Rewrite the correct code.&lt;UL TYPE = "a" START = 4&gt;

Answer»

<UL TYPE = "a" START = "4">

OR

<UL TYPE = "something''>

75.

Mention some disadvantages of XML.

Answer»

(i) XML syntax is large.

(ii) It occupies much higher memory which increases costs on transmission, storage and processing costs.

(iii) Namespace support is difficult.

76.

What are the advantages of XML?

Answer»

(i) XML is text based. 

(ii) Information can be understood easily due to its unicode structure and hierarchical representation. 

(iii) It is platform independent which makes it very easy to use. 

(iv) It supports most of the documents. 

(v) XML is free and extensible. 

(vi) It can be used to create new languages. 

(vii) It is a W3C Recommendation.

77.

State the XML naming rules.

Answer»

XML elements must follow these naming rules: 

(i) Names can contain letters, number and other characters 

(ii) Names cannot start with a number or punctuation character. 

(iii) Names cannot start with xml, XML or Xml... 

(iv) Names cannot contain spaces. 

(v) Any name can be used, no words are reserved.

78.

Write code to produce following HTML table?

Answer»

<html>

<title> Table </title>

<body>

<table border = "2" width = "20%">

<tr align = "center">

<td rowspan = "4" width = "20%" align = "center" >

A <br> B <br> C </td> <td colspan : "2" align = "center"> D </td>

</tr>

<tr>

<td align = "center"> E </td>

<td align = "centet"> F </td>

<td align = "center" rowspan = "2"> G </td>

</tr>

<tr>

<td align = "center" colspan = "2"> H </td>

</tr>

</table> </body> </html>

79.

Explain the src and align attribute of the IMG tag.

Answer»

Src - Specifies the URL of an image.

Align - Specifies the alignment of an image according to surrounding elements.

80.

What is the purpose of the TITLE element in HTML?

Answer»

The <title> tag is required in all HTML documents and it defines the title of the document.

The <title> element:

(i) defines a title in the browser toolbar.

(ii) provides a title for the page when it is added to favorites.

(iii) displays a title for the page in search-engine results.

81.

What is the difference between a valid XML document and a "well formed" XML document?

Answer»

A well formed XML document contains text and XML tags which confirm with the XML syntax.

Valid XML documents must be well formed and are additionally error checked against a DTD.

< ?xml version = "1.0" encoding = "ISO-8859-1'

?>

<! DOCTYPE employee SYSTEM "emp-dtd">

<employee>

<name> Rekha </name>

<empid> 6098 </empid>

< designation> Manager </designation>

</employee>

A valid document is used when documents require error checking, and many documents need to follow the same guidelines.

82.

Write the purpose of the following HTML tags : (i) &lt;HR&gt;(ii) &lt;BR&gt;

Answer»

(i) <HR> horizontal rule (or) Separate content or define thematic change.

(ii) <BR> Line break.

83.

What does 'XML' stand for? How is the purpose of HTML different from XML?

Answer»

XML stands for Extensible Markup Language.

HTML is used to design web pages. XML is used to transport data.

84.

Give the tags to define the following:(i) Textbox(ii) RadioButton(iii) CheckBox(iv) Submit button

Answer»

(i) < input type = "text">

(ii) < input type = "radio">

(iii) < input type = "checkbox">

(iv) < input type = "button" value = "submit" >

85.

What is the difference between radiobutton and CheckBox control?

Answer»

With RadioButtons, only one radio button out of many choices can be selected whereas as many CheckBoxes can be selected as desired.

86.

List different selection modes of a list.

Answer»

SINGLE (List box allows single selection only) SINGLE_INTERVAL (List box allows single continuous selection of options using shift key of keyboard) 

MULTIPLE_INTERVAL (List box allows multiple selections of options using ctrl key of keyboard).

87.

What are list type controls used for?

Answer»

A list is used to get one or more options out of several given options which may or may not be mutually exclusive. This may seem to be the case where CheckBoxes are to be used, but the difference is in the number of options available. If the number of options is small, then CheckBoxes can be used. In case of large number of options, using CheckBoxes may take up a lot of space on the form and it may also be inconvenient for the user to select the desired options. In such cases Lists are preferred over checkboxes. Examples of such cases are: To select cities out of a given list of cities, to select magazines out of a given list of magazines, etc.

88.

Differentiate between : (i) TextField and TextArea(ii) ComboBox and ListBox(iii) getText() and setText()

Answer»

(i) The TextField allows the user to enter a single line of text only. But TextArea component allows to accept multiline input from the user or display multiple lines of information. 

(ii) The ListBox is used to display a list of items but does not have a text field where as a Combo Box is used to display a drop down list of items. It is a combination of a text box in which a user enters an items and a drop downlist from which the user selects an item. 

(iii) getText() - gets the value entered in a TextField. setText() is used to print a value in the TextField.

89.

How would you determine whether a combobox is editable or not?

Answer»

if (cbo1.editable)( = = true)

90.

What will be displayed in jTextArea1 after the execution of the following loop?for (int i = 5; i &gt;= 2; i- -)jTextArea1.setText(jTextArea1.getText() + " " +Integer.toString (i*i));

Answer»

The correct output

25 16 9 4

91.

What will be displayed in jTextArea1 after the execution of the following code:int G = 1;do {jTextArea1.setText(Integer.tostring(G + + ));G = G+1;} while (G&lt;=5);

Answer»

The correct output

5

92.

What will be the content of the jTextArea1 after executing the following code:int n = 89;jTextArea1.setText(Integer.toString(++n));

Answer»

The correct output

90

93.

What will be the content of the jTextArea1 after executing the following code :(Assuming that the jTextArea1 had no content before executing this code)?for (int = C = 1; C = 4; C++){jTextArea1.setText()jTextArea1.getText() + " " + Integer.toString(C*C));}

Answer»

1. Syntax Error

2. Program will not Compile

3. No output

94.

What will be displayed in jTextArea1 after executing the following statement?jTextArea1.setText("GREAT\nCOUNTRY\tINDIA");

Answer»

GREAT

COUNTRY INDIA

95.

Write the output that will be displayed in the textfields by the following Java code:string x;string stream = "Commerce";jTextField1.setText((stream.length() +9) +" ");x = stream. concat("Humanities");jTextFiled2.setText(x);jTextField3.setText(" " + x.substring(2,5));jTextField4.setText(stream.toLowerCase());

Answer»

jTextField1 = 17

jTextField2 = Commerce humanities

jTextField3 = mme

jTextField4 = Commerce Humanities

96.

A Class Person has a subclass employee.Which of the following is true and why?(i) Class Employee can have no sub class(ii) Class Employee can have no other parent than Person class.(iii) Class Person can have atmost one sub class.

Answer»

Only statement (ii) is true because Java does not support multiple inheritance.

97.

Mr. Pawan works as a Programmer in "ABC Marketing Company" where he has designed a Salary generator software to generate the salary of salesman in which Name and Salary are entered by the user. A screenshot of the same is shown below :Help him in writing the code to do the following:After selecting appropriate Radio Button, when 'Commission' button is clicked, commission should be displayed in the respective text field as each Salesman will get a commission based on the units sold according to the following criteria:Unit SoldCommission(in Rs)1 to 2050020 to 401000&gt;402000

Answer»

Code to calculate and display commission:

int com = 0;

if(jRadioButton1.isSelected())

com = 500;

else if(jRadioButton2.isselected())

com = 1000;

else if(jRadioButton3.isSelected())

com = 2000;

iTextField3.setText("" + com);

98.

Mr. Pawan works as a Programmer in "ABC Marketing Company" where he has designed a Salary generator software to generate the salary of salesman in which Name and Salary are entered by the user. A screenshot of the same is shown below :Help him in writing the code to do the following:When 'Gross Salary' button is clicked, Gross Salary should be calculated and displayed in the respective text field as per the given formula:Gross Salary = Salary+Commission

Answer»

Code to calculate and display Gross Salary:

int sal,comm;

sal = Integer.parseInt(jTextField2.getText());

comm = Integer.parseInt( TextField3.getText());

jTextField4.setText(" " + (sal +comm));