CODE#29


public class TestMain {

public static void main(String args[]){
TestMain test = null;
System.out.println(test.returnValueFun());
}

public static String returnValueFun(){ return "TechnicalBaba.com";}

}


Option1 - Compile time Error
Option2 - Null pointer at run time
Option3 - Technicalbaba.com



Submitted By - Admin 
Sat Apr 02 16:52:48 IST 2016
Read Solution ( 0 )Like

0

Submit Solution

<br>

CODE#28

Java coding standards- Why should we use coding standards ?



Have you ever wondered that why your teacher always shout at you to write correct method name correct class name and in correct way.

Here is an explanation : If you follow the below given standards, you can easily understand any standard written code, And also you can write a code which can be easily understandable to other and show your intelligence. and For sure this will impress others too.

Coding standards :



1.all packages should be prefixed with: "com.yourchoice".

2. Class names are always nouns, and should always has first letter in uppercase ie. class Bird.

3.Interface names should always be an adjective (wherever possible) describing the enforced behaviors of the class (noun). Preferably, said adjective should end in "able" following an emerging preference in Java. i.e. Clonable.

4.Method names are typically verbs. However they can also be nouns for example accessor methods (see accessor methods below). and should always start with lowercase letter and follow camelcase after ie. doLogin() . also method should refer name which can best describe it‘s work.

5.Do not use abbreviations, use full names. Variable names begin with a lowercase letter. The initial letter of any subsequent words in the name are capitalized, and underscores are not used to separate words (or scope variables). Clarity of variable names can be increased by providing some indication of the type of class they might become.

Example :




package com.technicalbaba.utility; // package declaration
public class DatabaseUtil { // class declaration

int counter; // variable
public final String URL= "databse url"; // final variable

public Connection getNewDataBaseConnection(){ // method to get database connection
// code
}

// more code here

}



Hope you like it, Please share and spread happiness, Let us know your thoughts in comment section.We would love to post your article If you want to showcase your talent.



Submitted By - Admin 
Sun Jan 24 13:39:17 IST 2016
Read Solution ( 0 )Like

0

Submit Solution

<br>

CODE#27


11. class Alpha {
12. public void foo() { System.out.print("Afoo "); }
13. }
14. public class Beta extends Alpha {
15. public void foo() { System.out.print("Bfoo "); }
16. public static void main(String[] args) {
17. Alpha a = new Beta();
18. Beta b = (Beta)a;
19. a.foo();
20. b.foo();
21. }
22. }



Submitted By - Admin 
Sun Dec 20 13:37:40 IST 2015
Read Solution ( 0 )Like

0

Submit Solution

<br>

CODE#26

Hello Techies,

Technical Baba need your help again.

Baba is so old so he is not able to watch things correctly.
Sometimes he used to answer wrong and sometime correct.

Now can you make a similar system with equal probability of wrong and right answer.

Suggestion will be posted after two days.

try Now.



Submitted By - Admin 
Tue Nov 17 17:11:03 IST 2015
Read Solution ( 1 )Like

0

Submit Solution

<br>

CODE#25

Hello Techies,

Technical Baba stuck again, Now He don‘t know how to proceed, He was coding in JAVA.

Number keys are not working in his keyboard and he has to print output as given below -


Value =162

Please help him to get it printed.



Submitted By - Admin 
Sun Oct 25 01:19:05 IST 2015
Read Solution ( 2 )Like

0

Submit Solution

<br>
PAGES  1   2   3   4   5   6   NEXT