programming languages Online Quiz - 193
Description: programming languages Online Quiz - 193 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
package io; import java.io.*; public class TestFile { public static void main(String[] args) { File file = new File("test_file.txt"); System.out.print(" Fle Name = " + file.getName()); file.delete(); file.renameTo(new File("test_file2.txt")); System.out.print(" Fle Name = " + file.getName()); } }
package io; import java.io.*; public class TestFile1 { public static void main(String[] args) { //No file exists by the name test_file.txt File file = new File("test_file.txt"); System.out.print(" Fle Name = "+file.getName()); System.out.print(" File Status = "+file.exists()); } }
package inheritance; interface test_Int { void test(); } abstract class IntImplementer implements test_Int { public static void main(String[] args) { System.out.println("Hello World!"); } }
Signature has to be the same for overloading.
Overriding is an example of runtime polymorphism.
byte, short can be converted to char and vice versa.
Integer division by zero throws an exception.
package simplejava;public class TestConstructor{ int p ; public void TestConstructor(int p) { this.p=p; } public static void main(String[] args) { TestConstructor tp = new TestConstructor(10); TestConstructor tp = new TestConstructor(); System.out.println("p = "+tp.p); }}
package simplejava; public class TestConstructor2 { int p; TestConstructor2() { System.out.print(" I am in Constructor"); } TestConstructor2(int p) { this(); this.p = p; System.out.print(" p = " + p); } public static void main(String[] args) { TestConstructor2 tp1 = new TestConstructor2(10); } }
package simplejava;public class TestMain { TestMain() { System.out.println("I am in Constructor"); } TestMain(String message) { System.out.println("Message " + message); } public static void main(String[] args) { TestMain tm = new TestMain(); } public static void main(String args) { TestMain tm = new TestMain("Hello"); }}
Are you allowed to have more than one top-level(non-inner) class definition per source file?
Assume the bit pattern of byte x is: 10110001. What will the sign of x be after x>>2?
A class can define two methods with the same name as long as the return types are different