Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator).

Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator). Correct Answer Both false.toString() and String(false)

The three approaches for converting to string are: value.toString(),”” + value and String(value). A non-string can be converted in two ways without using a new operator false.toString () and String(false).

Related Questions

Assume that we have to convert “false” that is a non-string to string. The command that we use is (without invoking the “new” operator)
In the question below, are given a statement followed by three courses of actions numbered I, II and III. On the basis of the information given, you have to assume everything in the statement to be true, and then decide which of the following suggested courses of actions logically follow(s) for pursuing. Statement: Starting October, all new cars will have pedestrian safety features, including new design of the bonnet, to reduce impact on pedestrians during accidents. Advanced safety features are needed in all vehicles in India as vehicle safety cannot be confined to luxury vehicles only. Around 1.5 lakh people are killed in road accidents every year in the country, nearly 60% of them are pedestrians.  Courses of action: I. The government has set a target to reduce the number of road deaths by half in the next two years. The ministry of road transport and highways has been issuing new safety standards for the automobiles along with eliminating the black spots on national highways.  II. By next month, all new cars will have pedestrian safety feature, including new design of the bonnet, to reduce impact on pedestrians during accidents.  III. Ministry of road transport and Highways is planning to implement all safety features in vehicles with active support of vehicle manufacturers. Electronic stability control (ESC) and autonomous emergency braking (AEB) will be incorporated in new vehicles by 2022.
What will be the output when the following program is compiled and executed? abstract class TestAbstract{ String my_name; String myName(){ my_name = "Examveda"; return my_name; } abstract void display(); } public class Test extends TestAbstract{ void display(){ String n = myName(); System.out.print("My name is "+ n); } public static void main(String args[]){ Test t = new Test(); t.display(); } }