What will be the output of the following C# code? class a { public void fun() { Console.WriteLine("base method"); } } class b: a { public new void fun() { Console.WriteLine(" derived method "); } } class Program { static void Main(string[] args) { b k = new b(); k.fun(); Console.ReadLine(); } }
Q: In Java, all primitives (including String) are passed by value while all object types are passed by…
A: TRUE
Q: What will be the output of the following code? interface Test { int x = 10; } public class MyClass…
A:
Q: What will be the output of the following C# code? class A { public virtual void display() {…
A: Question. What will be the output of the following C# code? class A{public virtual void…
Q: What is the output of following piece of C# code? String s1 = "OBJECT_ORIENTED"; String s2; s2 = s1…
A: Answer is T_ORI s1 = "OBJECT_ORIENTED" s2 = s1 + "_ORIENTED" = "OBJECT_ORIENTED" + "_ORIENTED" =…
Q: consider the following definition of the class Myclass: public class Myclass{ private static int…
A: Hey, thank you for your question. As there are multiple parts in your code, we can produce solutions…
Q: What are difference between constructor and method o in java? Ans: ?
A: A method can be defined as a block of code enclosed in braces {} and executes only upon invocation.…
Q: What will be the output of the following C# code? public class sample { public static…
A: Question. What will be the output of the following C# code? public class sample {…
Q: 1 import java.util.Scanner; 2 3 public class DeclaringVariables { public static void main(String[]…
A: import java.util.Scanner; public class DeclaringVariables { public static void main (String[] args)…
Q: What is the output of the below Java program with constructors? public class Constructor2 { int…
A: The output of the java program is -
Q: PROGRAM Employee.java //Abstract class Employee abstract class Employee { // Attributes of the…
A: Answer: our guidelines is answer the first three sub part form the first part. So I have converted…
Q: Explain this c# in your own wording and also his output??? using System; namespace…
A: Given: Explain this c# in your own wording and also his output??? using System; namespace…
Q: Let ?(?) be the statement “? can program in C++,” let ?(?) be the statement “x can program in Java,”…
A: We need to express the statements in terms of quantifiers and logical connectives. Domain consists…
Q: Show the output of running the class Test in the following code lines: interface A { } class C{ }…
A: output:
Q: What is difference between over written and non over written methods in java (Object Oriented…
A: According to the question Overriding and overloading the concepts in the Java system. Ways to create…
Q: Write a C++ program to read two objects -lengths l1, l2 in the form of yards and foots by using a…
A: Programs: Programs are used to read the input from the user, process the input according to the…
Q: Consider the following class definitions public class SampleClass{ public String greet() {return…
A: In the given below code public class SubClass extends SampleClass{ public string greet() {return…
Q: What is type casting in java? Give example
A: Question. What is type casting in java? Give example Answer. Type casting: When we assign a value of…
Q: Answer the following questions from Library.java 1. Write the different class names with class…
A: Library.java - This class represents a collection of books and provides methods for managing them.
Q: Given the following C# code: class Program { static void Main(string[] args) { derivedClass obj =…
A: Answer: d. Compile time error
Q: Assume static method printGenericCollection(c) prints the contents of a given object c that has type…
A: The following solutions are
Q: What is the Output? public static void main(String[] args) { new…
A: Hello Student, Hope you are doing great in study and coding. Warm greetings from my side. I will try…
Q: What is the result of running this code. As always, explaining what is happening allows me to give…
A: There is one java program given, public class HelloWorld{ public static void main(String…
Q: Write a C# program that takes in two numbers from the user. The program must make use of a method…
A: Logic:- take two numbers from user and store it in two variables first and second. display message…
Q: What will be the output of the following programs? 1- 2- enum Directions { NORTH, SOUTH, WEST, EAST;…
A: The solution for the above given question is given below:
Q: PLZ help with the following in java TRUE OR FALSE An interface can contain defined constants as…
A: Java interfaces are of simulating multiple inheritance, so they can contain defined constants as…
Q: Consider the program below. What is the output of the program when it is:
A: Given code: int i=25; void A(void) { printf("A1: %d \n",i); i--; printf("A2: %d \n",i); }…
Q: Please answer the question and explain why. 3. What is wrong with the following program and…
A: In the given code have 1 major mistake and one minor mistake. ===================================…
Q: c. What RuntimeException will the following program throw, if any? public class Test { public static…
A: According to the provided information: We need to find out the exception given by the program.
Q: Write the appropriate method headings using the provided met Following processes. JAVA PROGRAMMING
A: //Java Program import java.util.Scanner; public class StudentDetails{ public static void…
Q: In Java please,
A: Program is given below:-
Q: IS public interface A { public int methodl () { return 1; } public interface B { } default int…
A: Answer: 4
Q: ite a program in java To pass null argument with method overloading with string and object type
A: Required: Write a program in java To pass null argument with method overloading with string and…
Q: what is the output of the following codes : code 1. class A { {…
A: code1: //lets trace the code for outputclass A { { System.out.print(1);//this prints 1…
Q: please fix what is wrong with the below C# code:
A: 1. In your code the checkGuess function should be separate from main function 2. Main function…
Q: write a c++ program Write a class Date that represents a date consisting of a year, month, and day.…
A: #include<iostream> #include <string> using namespace std; class Date { public: Date(…
Q: java program
A: a) Given source code: class Base {public void Print() {System.out.println("Base");}}class Derived…
Q: using System; class Program { // Define PrintBoard method public static void PrintBoard()…
A: Given: using System; class Program{ // Define PrintBoard method public static void…
Q: 1) What will be the output of the following code? interface Test { void print(); } public class…
A: As per our guidelines, we are only supposed to answer one question. I have answered 3 of your…
Q: What will be the output of the following code? interface Test { int x = 10; } public class MyClass…
A: Given, Java code: interface Test {int x = 10;}public class MyClass implements Test{public void…
Q: What will be the output of the following code? interface Test { void print(); } public class MyClass…
A: Given, Java program: interface Test {void print();}public class MyClass implements Test {void…
Q: What will be the output of the following C# code? class A { public int i; public void display() {…
A: Question. What will be the output of the following C# code? class A{public int i;public void…
Q: A. list down the different benefits of using a method in JAVA programming. B. Provide the syntax…
A: A) ->Main benefit is code reusability. We can write a method once, and then we can call it…
Q: Why is the size in memory of a variable of type int and the size in memory of a reference in Java is…
A: size in memory of a variable of type int is 4 bytes
Q: 4. What will print when the main method below is executed? public static void main (String [] args)…
A: Hello student , hope you are doing good . The answer to both of the question is attached below…
Q: In the Ruby expression a.foo , which calls method foo on receiver a, which of the following…
A: For start, every object is an instance of some class. Classes themselves are instances of the Class…
Q: import java.io.*; class Super { void show() { System.out.println("parent"); } } public class Sub…
A: as per Bartleby guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: What is o/p of following program public class Parent { public static void staticMethod(){…
A: Program Execution begins from main and main method is written inside Parent class
Q: 5). What will be the output of the following code? interface Test { int x = 10; } public class…
A: Answer:-(C) compilation error
Q: What is the output of the following code? public class Main { void aMethod(){…
A: Show the output of the following code- public class Main{ void aMethod(){System.out.println("Final…
Q: Write a program in either C++, Java, or C# that illustrates the order of evaluation of expressions…
A: Parameters passed to the method expressionEvaluation() are evaluated from right to left ++x : this…
What will be the output of the following C# code?
class a
{
public void fun()
{
Console.WriteLine("base method");
}
}
class b: a
{
public new void fun()
{
Console.WriteLine(" derived method ");
}
}
class
{
static void Main(string[] args)
{
b k = new b();
k.fun();
Console.ReadLine();
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Consider the following code in Java 8:public interface Runnable{void run() ;}public final class Caller {public static void call (String before, String after, Runnable r) (System.out.println(before);r. run() ;System.out.println(after);} }public class MyClass{public static void main(String args[]) (Caller.call("BEFORE", "AFTER",); } }Complete the blark line with some code so that the program prints the folowing to the output: BEFOREHi there!AFTERWrite a program in either C++, Java, or C# that illustrates the order of evaluation of expressions used as actual parameters to a method.Plese help me with this: The following Java program needs to be converted to C++, with .h and cpp files. PROGRAM Employee.java //Abstract class Employee abstract class Employee { // Attributes of the class private String firstName; private String lastName; private String SSN; // Getters and setters public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getSSN() { return SSN; } public void setSSN(String sSN) { SSN = sSN; } /* * Abstract method getEarnings, this method will be implemented by all child * classes */ public abstract double getEarnings(); // toString method public String toString() { return "firstName=" + firstName + ", lastName=" + lastName + ", SSN=" + SSN; } // Equals method public boolean equals(Object obj) { // TODO Auto-generated method stub return…
- in C# errors are in pics class Program { static void Main(string[] args) { Bank myBank = new Bank(); // Adding bank accounts BankAccount account1 = new BankAccount { AccountNumber = "001", AccountHolderName = "John Doe", Balance = 5000, AccountType = AccountType.Savings }; myBank.AddAccount(account1); BankAccount account2 = new BankAccount { AccountNumber = "002", AccountHolderName = "Jane Smith", Balance = 10000, AccountType = AccountType.Current }; myBank.AddAccount(account2); BankAccount account3 = new BankAccount { AccountNumber = "003", AccountHolderName = "Bob Johnson", Balance = 7500, AccountType = AccountType.Savings }; myBank.AddAccount(account3); // Searching for an existing account and displaying its details Console.WriteLine("Enter the account number to search: "); string accountNumber = Console.ReadLine(); BankAccount foundAccount =…This is C++. Please explain in details so I can understand the questions.What is the output of the following C++ program? #include <iostream>#include <string>using namespace std;class baseClass{public:void print() const;baseClass(string s = " ", int a = 0);//Postcondition: str = s; x = a;protected:int x;private:string str;};class derivedClass: public baseClass{public:void print() const;derivedClass(string s = "", int a = 0, int b = 0);//Postcondition: str = s; x = a; y = b;private:int y;};int main(){baseClass baseObject("This is the base class", 2);derivedClass derivedObject("DDDDDD", 3, 7);baseObject.print();derivedObject.print();system("pause");return 0;}void baseClass::print() const{cout << x << " " << str << endl;}baseClass::baseClass(string s, int a){str = s;x = a;}void derivedClass::print() const{cout << "Derived class: " << y << endl;baseClass::print();}derivedClass::derivedClass(string s, int a, int b) :baseClass("Hello…please fix what is wrong with the below C# code: using System; namespace Animals{ class Animals { public static bool CheckGuess(string animalType, string typeGuess) { static bool Main(string[] args, string animalType, string typeGuess) { if (String.Equals(animalType, typeGuess)){ return true; } return false; } string animalType = "Dog"; string typeGuess; int count = 0; bool result; Console.Write("Guess the animal: "); typeGuess = Console.ReadLine(); while(true){ count++; result = CheckGuess(animalType, typeGuess); if(result){ Console.WriteLine("You have Guess it Correct in " + count + " times.\n"); break; } else{ Console.WriteLine("You have Guess it Wrong " + count + " times!!\n"); Console.Write("Guess the animal again: "); typeGuess = Console.ReadLine();…
- Explain this c# in your own wording and also his output??? using System; namespace ConsoleApplication4 { abstract class A { public int i; public abstract void display(); } class B : A { public int j; public int sum; public override void display() { sum = i + j; Console.WriteLine(+i + "\n" + +j); Console.WriteLine("sum is:" + sum); } } class Program { static void Main(string[] args) { A obj = new B(); obj.i = 2; B obj1 = new B(); obj1.j = 10; obj.display(); Console.ReadLine(); } } }PLZ help with the following in java TRUE OR FALSE An interface can contain defined constants as well as method headings or instead of method headings.What is the output of the following C++ code? #include <iostream> using namespace std; class BaseClass { protected: int i; public: BaseClass(int x) { i = x; } ~BaseClass() { } }; class DerivedClass: public BaseClass { int j; public: DerivedClass(int x, int y): BaseClass(y) { j = x; } ~DerivedClass() { } void show() { cout << i << " " << j << endl; } }; int main() { DerivedClass ob(3, 4); ob.show(); return 0; }