Page 1 of 11 > >> |
From: | Reply 1 of 205 | Reply | |
Subject: |
|
From: yogesh0 | Reply 2 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 19 |
1
Only one return statement can be executed.
Posted at: Mon Nov 23 21:29:54 2009 (GMT)
|
From: suman65 | Reply 3 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 15 |
String S ="275";
Posted at: Fri Nov 27 14:58:05 2009 (GMT)
|
From: nihar | Reply 4 of 205 | Reply | View replies (1)
|
Subject: Contributed Answer/Explanation to Q. 1 |
Applets and applications
Posted at: Sun Nov 29 15:09:38 2009 (GMT)
|
From: nihar | Reply 5 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 4 |
double x=3.142
Posted at: Sun Nov 29 15:10:13 2009 (GMT)
|
From: nihar | Reply 6 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 9 |
lang
Posted at: Sun Nov 29 15:10:30 2009 (GMT)
|
From: nihar | Reply 7 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 21 |
(f) four:42 (g) four:4
Posted at: Sun Nov 29 15:12:50 2009 (GMT)
|
From: raveenasainibhondi | Reply 8 of 205 | Reply | View replies (1)
|
Subject: Contributed Answer/Explanation to Q. 10 |
import
Posted at: Fri Dec 4 13:44:45 2009 (GMT)
|
From: raveenasainibhondi | Reply 9 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 10 |
import
Posted at: Fri Dec 4 13:45:18 2009 (GMT)
|
From: raveenasainibhondi | Reply 10 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 16 |
int a=integer.parseInt(str);
Posted at: Fri Dec 4 13:47:17 2009 (GMT)
|
From: raveenasainibhondi | Reply 11 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 17 |
total=total+a;
Posted at: Fri Dec 4 13:47:37 2009 (GMT)
|
From: shree99 | Reply 12 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 13 |
a=(0.05-(2*y*y*y))/(x-y);
java syntax
Posted at: Sat Dec 12 08:59:12 2009 (GMT)
|
From: mintu | Reply 13 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 1 |
Appelet and Application
Posted at: Wed Dec 30 14:43:15 2009 (GMT)
|
From: mintu | Reply 14 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 3 |
Binary : needs sorted array , Linear : can search in unsorted array.
Posted at: Wed Dec 30 14:45:09 2009 (GMT)
|
From: sankumdur | Reply 15 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 29 |
Look the explanation
import java.io.*;
public class temperature
{
public static void main(String argv[]) throws IOException
{
DataInputStream input=new
DataInputStream(System.in);
int ch;
double f,c;
System.out.print("\n***** Teperature
Conversion *****");
System.out.print("\n\n1. Celsius To
Fahrenheit");
System.out.print("\n2. Fahrenheit To Celsius");
System.out.print("\n\nSelect Your Choice (1 or
2) :: ");
ch=Integer.parseInt(input.readLine());
switch(ch)
{
case 1:
System.out.print("\n\nInput temperature in degree centigrade :: ");
c=Double.parseDouble(input.readLine());
f=1.8*c+32;
System.out.print("\n\nFahrenheit = "+f);
break;
case 2:
System.out.print("\n\nInput temperature in degree Fahrenheit :: ");
f=Double.parseDouble(input.readLine());
c=(5/9)*(f-32);
System.out.print("\n\nCelsius = "+c);
break;
default:
System.out.print("\n\nWrong choice entered");
break;
}
}
}
Posted at: Mon Jan 4 12:48:22 2010 (GMT)
|
From: biswajitm | Reply 16 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 2 |
An object that belongs to a class is said to be an instance of that class.
The variables that the object contains are called instance variables.
<!--
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
-->
<ol>
<p style="margin-bottom: 0in">
<font face="Arial, sans-serif">class
Student {</font>
</p>
</ol>
<pre>
<font face="Arial, sans-serif"><font size="3">
String name; // Student's name.</font></font>
<font face="Arial, sans-serif"><font size="3"> double
test1, test2, test3; // Grades on three tests.</font></font>
<font face="Arial, sans-serif"><font size="3"> double
getAverage() { // compute average test grade</font></font>
<font face="Arial, sans-serif"><font size="3">
return (test1 + test2 + test3) / 3; }</font></font>
<font face="Arial, sans-serif"><font size="3">
} </font></font>
</pre>
<p>
<font face="Arial, sans-serif"> public static void main(String
args[])</font>
</p>
<p>
<font face="Arial, sans-serif"> {</font>
</p>
<p style="margin-bottom: 0in">
<font face="Arial, sans-serif"> </font><font
face="Arial, sans-serif"><font size="3">Student
std;</font></font><font face="Arial, sans-serif"><font
size="3"> </font></font>
</p>
<p style="margin-bottom: 0in">
<font face="Arial, sans-serif"><font size="3"> std
= new Student();</font></font><font face="Arial,
sans-serif"><font size="3">
</font></font>
</p>
<p style="margin-bottom: 0in">
<font face="Arial, sans-serif"><font size="3">
System.out.println("Hello,
" + std.name + ". Your test grades are:");</font></font>
</p>
<pre>
<font face="Arial, sans-serif"><font size="3">
System.out.println(std.test1); </font></font><font
face="Arial, sans-serif"></font>
</pre>
<pre>
<font face="Arial, sans-serif"><font size="3">
System.out.println(std.test2);</font></font>
<font face="Arial, sans-serif"><font size="3">
System.out.println(std.test3);</font></font>
</pre>
<pre>
<font face="Arial, sans-serif"><font size="3">// test1, test2,
test3 are instance variables</font></font>
</pre>
<pre>
<font face="Arial, sans-serif">}</font>
</pre>
Posted at: Tue Jan 5 11:05:56 2010 (GMT)
|
From: biswajitm | Reply 17 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 5 |
if-else-if construct is given in the below example
<!--
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
-->
<ol>
<li>
<ol>
<p style="margin-bottom: 0in">
<font face="Arial, sans-serif"><span
style="font-weight: normal">class
IfElseDemo {</span></font>
</p>
</ol>
</li>
</ol>
<pre>
<font face="Arial, sans-serif"><font
size="3">public static void main(String[] args)
</font></font>
<font face="Arial, sans-serif"><font size="3">
{</font></font>
<font face="Arial, sans-serif"><font size="3">
int testscore = 76;</font></font>
<font face="Arial, sans-serif"><font size="3">
char grade;</font></font>
<font face="Arial, sans-serif"><font size="3">
if (testscore >= 90) grade = 'A';</font></font>
<font face="Arial, sans-serif"><font size="3">
else if (testscore >= 80) grade = 'B';</font></font>
<font face="Arial, sans-serif"><font size="3">
else if (testscore >= 70) grade =
'C';</font></font>
<font face="Arial, sans-serif"><font size="3">
else if (testscore >= 60) grade =
'D';</font></font>
<font face="Arial, sans-serif"><font size="3">
else grade = 'F';</font></font>
<font face="Arial, sans-serif"><font size="3">
</font></font><font face="Arial, sans-serif"><font
size="3"> System.out.println("Grade = " +
grade);</font></font>
<font face="Arial, sans-serif"><font size="3">
}</font></font>
<font face="Arial, sans-serif"><font size="3">
}</font></font>
<font face="Arial, sans-serif"><font size="3"> O/P
: Grade= C</font></font>
</pre>
Posted at: Tue Jan 5 11:08:08 2010 (GMT)
|
From: biswajitm | Reply 18 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 6 |
Formal parameters are the parameters as they are known in the function
definition. Actual parameters (also known as arguments) are what are passed
by the caller.
<!--
@page { margin: 0.79in }
P { margin-bottom: 0.08in }
-->
<p>
<font face="Arial, sans-serif">For example, in the following code,
a and b are the formal parameters, and x and y are the actual
parameters: <br />
</font>
</p>
<p>
<font face="Arial, sans-serif">int max(int a, int b) { <br />
if (a > b) return
a; <br />
else return b; <br />
} </font>
</p>
<p>
<font face="Arial, sans-serif">int m = max(x, y); </font>
</p>
Posted at: Tue Jan 5 11:09:25 2010 (GMT)
|
From: biswajitm | Reply 19 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 11 |
Math Class
<p>
<font
color="#7f0055"><strong>public class </strong></font>
<font color="#000080">mathclass{<br />
</font>
<font color="#ffffff"> </font><font
color="#7f0055"><strong>public static </strong></font>
;<font
color="#7f0055"><strong>void </strong></font><font
color="#000080">main(String[] args){<br />
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//E and round()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"e = " </font><font
color="#000080">+ Math.round(Math.E*</font><font
color="#990000">100</font><font
color="#000080">)/</font><font
color="#990000">100f</font><font color="#000080">);<br
/>
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//PI</font><br />
<font color="#ffffff"> </font><font
color="#000080"> System.out.println(</font><font
color="#2a00ff">"pi = " </font><font
color="#000080">+ Math.round(Math.PI*</font><font
color="#990000">100</font><font
color="#000080">)/</font><font
color="#990000">100f</font><font color="#000080">);<br
/>
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//abs()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Absolute number = " </font><font
color="#000080">+ Math.abs(Math.PI));<br />
</font><font color="#ffffff"> </font><font
color="#3f7f5f">//ceil()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Smallest value but greater than </font>
</p>
<p>
<font color="#2a00ff">
the argument = " </font><font
color="#000080">+ Math.ceil(Math.PI));<br />
</font><font color="#ffffff"> </font><font
color="#3f7f5f">//exp()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Exponent number powered by </font>
</p>
<p>
<font color="#2a00ff">
the argument = "</font><font
color="#000080"> + Math.exp(</font><font
color="#990000">0</font><font color="#000080">));<br />
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//floor()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Largest value but less </font>
</p>
<p>
<font color="#2a00ff">
than the argument = " </font><font
color="#000080">+ Math.floor(Math.E));</font><br />
<font color="#ffffff"> </font><font
color="#3f7f5f">//IEEEremainder()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Remainder = " </font><font
color="#000080">+ </font>
</p>
<p>
<font color="#000080">
Math.IEEEremainder(</font><font
color="#990000">5.3f</font><font
color="#000000">,</font><font
color="#990000">2.2f</font><font color="#000080">));<br
/>
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//max()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Maximum Number = " </font><font
color="#000080">+ Math.max(</font><font
color="#990000">10</font><font
color="#000000">,</font><font
color="#990000">10.3</font><font
color="#000080">));</font><br />
<font color="#ffffff"> </font><font
color="#3f7f5f">//min()</font><br />
<font color="#ffffff"> </font><font
color="#000000">System.out.println</font><font
color="#000000">(</font><font
color="#2a00ff">"Minimum Number = " </font><font
color="#000080">+ Math.min(</font><font
color="#990000">10</font><font
color="#000000">,</font><font
color="#990000">10.3</font><font color="#000080">));<br
/>
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//pow()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Power = " </font><font
color="#000080">+ Math.pow(</font><font
color="#990000">10</font><font
color="#000000">,</font><font
color="#990000">3</font><font color="#000080">));<br />
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//random()</font><br />
<font color="#ffffff"> </font><font
color="#000080"> System.out.println(</font><font
color="#2a00ff">"Random Number = " </font><font
color="#000080">+ Math.random());<br />
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//rint()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Closest to the Argument </font>
</p>
<p>
<font color="#2a00ff">
= " </font><font
color="#000080">+ Math.rint(</font><font
color="#990000">30</font><font color="#000080">));<br
/>
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//round()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Round = "</font><font
color="#000080"> + Math.round(Math.E));<br />
</font>
<font color="#ffffff"> </font><font
color="#3f7f5f">//sqrt()</font><br />
<font color="#ffffff"> </font><font
color="#000080">System.out.println(</font><font
color="#2a00ff">"Square Root = " </font><font
color="#000080">+ Math.sqrt(</font><font
color="#990000">400</font><font color="#000080">));<br
/>
}<br />
}</font>
</p>
Posted at: Tue Jan 5 13:19:26 2010 (GMT)
|
From: biswajitm | Reply 20 of 205 | Reply | |
Subject: Contributed Answer/Explanation to Q. 14 |
Answer
income <= 10000?tax=0:tax=12;
Posted at: Tue Jan 5 13:25:26 2010 (GMT)
|
Page 1 of 11 > >> |