Thursday 29 November 2012

CS506 Answer



On Sun, May 20, 2012 at 8:39 PM, Umair Saulat <saulat.umair@googlemail.com> wrote:
Thanks for guidance 

On Sun, May 20, 2012 at 6:44 PM, Zubair Hussain <zubair@vuzs.net> wrote:
Dear Umair, 

Your codes are not right on target in question  following things are asked which are not in your codes.

database type name of second column 

Here are the right codes. I tried my best to be on target. I wrote my comments in green to clear the logic.

ResultSet rs = stmt.executeQuery("SELECT * FROM TABLE2");
     ResultSetMetaData rsmd = rs.getMetaData();
String secondColName ;  // creat a varible to hold name of filed
secondColName = rsmd.getColumnName(2); // getColumnName(2) method will extract 2nd column name
System.out.println(secondColName); // display name of 2nd column.
int columnType; // variable to hold the value of columntype
columnType = rsmd.GetColumnType(2);// This method returns the underlying database type, rather than a FieldType



Regards

Zubair Hussain
www.vuzs.net



On Sun, May 20, 2012 at 2:44 PM, Umair Saulat <saulat.umair@googlemail.com> wrote:
Thanks Bhai 

Please confirm the answer is true:

Write down the code for a method of ResultMetaData object (rs) to return the database type name of second column


Solution 

An object that can be used to get information about the types and properties of the columns in a ResultSet object. The following code fragment creates the ResultSet object rs, creates the ResultSetMetaData object rsmd, and uses rsmd to find out how many columns rs has and whether the first column in rs can be used in a WHERE clause.

 

ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");

     ResultSetMetaData rsmd = rs.getMetaData();

     int numberOfColumns = rsmd.getColumnCount();

     boolean b = rsmd.isSearchable(1);

 

Ref: http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/ResultSetMetaData.html



On Sun, May 20, 2012 at 1:19 PM, Zubair Hussain <zubair@vuzs.net> wrote:
Right Answer is : False

Rational:
Purpose of declaring a method final is that it is not overridden by
sub-classes. So its possible that a method can be final while its class is not.

for example:

public class MyClass {
 public final void myFinalMethod() {...}
} 


Regards

Zubair Hussain
www.vuzs.net



On Sun, May 20, 2012 at 7:57 AM, Umair Saulat <saulat.umair@googlemail.com> wrote:
A method can not be made final until whole class is made final. 
► True
► False

--
Zindagi mein 2 Logo ka buhat khayal rahkoooo

Ist woh jiss ney tumhari jeet ke Liye buhat kuch hara hoo (Father)

2nd woh jiss ko tum ney har dukh me pukaara hoo (Mother)

Regards, 
Umair Saulat

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
 
To post a new message on this group, send email to vuZs@googlegroups.com
 
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email to vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
 
To post a new message on this group, send email to vuZs@googlegroups.com
 
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email to vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe



--
Zindagi mein 2 Logo ka buhat khayal rahkoooo

Ist woh jiss ney tumhari jeet ke Liye buhat kuch hara hoo (Father)

2nd woh jiss ko tum ney har dukh me pukaara hoo (Mother)

Regards, 
Umair Saulat

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
 
To post a new message on this group, send email to vuZs@googlegroups.com
 
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email to vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
 
To post a new message on this group, send email to vuZs@googlegroups.com
 
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email to vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe



--
Zindagi mein 2 Logo ka buhat khayal rahkoooo

Ist woh jiss ney tumhari jeet ke Liye buhat kuch hara hoo (Father)

2nd woh jiss ko tum ney har dukh me pukaara hoo (Mother)

Regards, 
Umair Saulat

--
--
Please visit www.vuzs.net For Current & Old Papers, Quizzes, Assignments and study material.
 
To post a new message on this group, send email to vuZs@googlegroups.com
 
Message Posting Rules: http://vuzs.net/faq/4795-vuzs-google-groups-basic-rules-for-posting-messages.html
--
To unsubscribe from this group, send email to vuZs+unsubscribe@googlegroups.com
--
To join this group Send blank email to vuZs+subscribe@googlegroups.com
or visit
http://groups.google.com/group/vuZs/subscribe

No comments:

Post a Comment

Note: only a member of this blog may post a comment.