What will be the output of the following Java code snippet? enum Levels { private TOP, public MEDIUM, protected BOTTOM; }
Q: Write a java statement to define a static method named calcAverage() which returns the average…
A: import java.util.scanner; public class excercise12 { public static void main(string[] args) {…
Q: What is the type of a value returned by the method readLine in the classBufferedReader? What is the…
A: Given : What is the type of a value returned by the method readLine in the class BufferedReader?…
Q: 2- Are there any Syntax Error(s) in this code? 1 class AAA 2 ( public int x; public int y; public…
A: There is a syntax error in line 8 .
Q: java Which one of the following is not an access modifier (ignore upper case)? Public Private…
A: Access modifier are used to restrict the access of class, data members, methods, etc.
Q: ?A java class must contain one main method if it is an application True O False
A: An application need main method as entry point to start execution. Because JVM will look for main…
Q: What will be the output of the following Java code? public class A { void A() {…
A: Program: //Defining class A public class A { //Defining member function A() void A() {…
Q: 11. Suppose your program contains the following class definition: class myClass ( public:…
A: Your answer is given below with proper explanation.
Q: What is the output of the following java code? = new File ("C:\\Users\\t99\\Desktop\\java.txt");…
A:
Q: Give name of 10 reserved words in Java Programming?
A: Question wants names of Reserved words in java.
Q: QUESTION 3: Advanced Java Programming Analyse the following Java code segment and answer the…
A: Problems are in line number 4, 10 and 11
Q: When is it OK to use the super keyword? In java
A: Introduction: The super keyword is used to refer to items in the superclass (parent) When is it OK…
Q: What will be the output of the following Java program? class Output { public…
A: GIVEN: What will be the output of the following Java program? class Output {…
Q: Does code Segment loads the java code? i) True ii) False
A: Question. Does code Segment loads the java code? i) True ii) False
Q: What is the value of finalAmount after executing the following code? ( Assume each class is defined…
A: Required:
Q: What is the stored in the object obj in following lines of Java code? box obj;
A: Please comment in case of any doubt.
Q: What is the output of the following java code? String A = “Oman Football”; String B =…
A: refer to step 2 for the answer.
Q: switch b. Class c.
A: Reserved words in Java: Keywords are words that have already been defined for the Java compiler.…
Q: What will be the output of the following Java code? 1. class access 2. public int x; 3. 4. private…
A: Let's take a look into access modifiers in java and types of errors: The access modifiers in Java…
Q: What will be the output of the following Java code? import java.io.*; class files { public static…
A: Question. What will be the output of the following Java code? import java.io.*;class files{public…
Q: Question-6. Which of the following is the result of the following Java code? class TestApp { String…
A: I have provided this answer in step-2.
Q: Which of the following members take * :values in test object Class Test (int xyz,; Static int xyz2;…
A: The above question involves the class and the members and methods that are created in the class.…
Q: What
A: An object is a real world entity For eg. A Fruit class can have object like- Apple, Banana, Mango…
Q: Is the following true or false IN JAVA In java it is possible to throw an exception, catch it, then…
A: In java it is possible to throw an exception, catch it, then re-throw that same exception if it is…
Q: Which of these is supported by method overriding in Java? Select one: O a. None of the mentioned O…
A: Java is really a language for high-level programming developed by Sun Microsystems. These were…
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: In Java, which data type stores the following text: "You are amazing."?
A: In Java, the datatype which stores the text "You are amazing." is String. Below is the given example…
Q: QUESTION 3: Advanced Java Programming Analyse the following Java code segment and answer the…
A: Below is the answer:
Q: Which of the following statements does not correctly create an object instance in Python? Choose the…
A: Object is a unique instance of a data structure that is defined by its class. An object comprises…
Q: Write the Java statement that creates the object mysteryClock of the Clock type, and initializes the…
A: the statement is given below:
Q: QUESTION 3: Advanced Java Programming Analyse the following Java code segment and answer the…
A: 1st error is Input Y is an array type so we have to assign it as array.( [. ] Y)
Q: Which of the following statements are valid in Java? (i) student1 = student2; (i)…
A: A constructor is a special method which is invoked as an object is created of that class.
Q: What is the output of the below java program:- class Test { public static void main…
A: class Test { public static void main (String args[]) {…
Q: Which of these is true about garbage collection in Java? O It happens whenever you instantiate an…
A: Garbage Collection in Java is process of destroying the unused objects. Thus, it makes java memory…
Q: the following code throws a NullPointerException in Java: String nickName = roster[1]…
A: Null Pointer Exception is Runtime Exception.
Q: In order for a method to be accessible to external Java packages, we must use this keyword: external…
A: In order for a method to be accessible to external Java packages, we must use public keyword. Public…
Q: 5. What is the output of the following java code? = new File ("C:\\Users\\t99\\Desk System.out.print…
A: getName is a method available in File class which will return the file name as String
Q: What do you think is the type of each of the following fields? private int count; private Student…
A: Datatype constrains the values that an expression,such as a variable or a function, might take.
Q: every line and it splits the line by comm
A: To split the string by space or comma, pass a following regular expression to the split() method -…
Q: Which of these is supported by method overriding in Java? Select one: O a. Encapsulation O b. None…
A: If the subclass will have the same method as defined in the parent class, it is referred to as the…
Q: What will be the output of the following Java code snippet? enum Enums { A, B, C; private Enums()…
A: Given, Code: enum Enums{A, B, C; private Enums(){System.out.println(10);}} public class…
Q: What will be the output of the following Java code? 1. class A 2. 3. int i; void display() 4. 5. {…
A: Given, Code: class A { int i; void display() { System.out.println(i);…
Q: java Constants take up no memory space? Choose one of the options: True False
A: False
Q: What is the output of the following java code? String A = “Teaching”; String B = “English…
A: we are solving this question here given java program we have to find the output
Q: Given the code below, which of the following statements could go in the main block and would execute…
A: 1.m=Mystery() print(m) Explanation: In this code there is a function called main that prints the…
Q: It is the method of hiding certain elements of the implementation of a certain class? Select one: O…
A: Encapsulation - It is basically the binding of data methods and variables in a single unit like a…
Q: 1.Write a JavaFX application called (Q2.java in default package) to display the following Graphical…
A: Solution 1. Implementation of public void paint(Graphics g) : public void paint(Graphics g) {…
Q: Which of the following statements is FALSE about classes in Java? o Every program is a class. All…
A: Lets see the solution.
Q: What is the output of the following code? class A { public A() { System.out.println( "A's no-arg…
A: No constructor is provided for class B So for class B default constructor will be provided by…
Q: You can use the following method header to override the equals method in Object class: public…
A: True
What will be the output of the following Java code snippet?
enum Levels
{
private TOP,
public MEDIUM,
protected BOTTOM;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Object Oriented Programming: 213COMP, 214COMP (Feb-2022) Assignment- I [10 marks] Academic honesty: O Only pdf file accepted & student ID, will be your upload file. O Student who submit copied work will obtain a mark of zero. O Late work or attach file by email message not allowed. Q1: Write the signature for a method that has one parameter of type String, and does not return a value. Q2: Write the signature for a method that has two parameters, both of type Student, and returns an int value. Q3: Write the constructor's headers of the followings? new Student (202101156, “Ahmed"); new Address(51, "jazan university","CS&IT" ); new Grade(true, 505235600, 4.5); Q4: a) Write a class Student that define the following information: name, stid , age. b) Explain a mutators (setters) and accessors(getters) methods for each attributes(fields). c) Add three constructors: • with empty constructor. one parameter constructor (name of student) two parameters constructor (name and stid) d) Create two…8- Create an instance of the following class and call its methods. class Exam{ int grade; public: void seta (int b) (grade=b; } int geta () {return grade; } 9- When the word const is put before the variable definition, what does that mean? 10- How to concatenate two strings in C++ language? C++Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks: 1. Display the current year, month, and day. 2. Display the current date by using the to String() method from the Date class. 3. Display the current time-which is used to display the number of milliseconds- by using getTime() method from the Date class. We will use it in the step 17. 4. - Display the current year by using get(GregorianCalendar.YEAR) method from to GregorianCale class. 5-…
- Enter the name of Stock: Oracle Corporation Enter the symbol of Stock: URCL Enter the previous closing price: 34.5 Enter the current price: 34.35 Stock name: Oracle Corporation Stock symbol: ORCL Stock ID: 59 Price-change percentage: - 0.434782608695648 Challenge Question - Using GregorianCalendar and Date classes: (Use the GregorianCalendar class) Java API has the Date class and GregorianCalendar class in the java.util package, which you can use to obtain the current date with specific details like current year, current month, current day of a date and so on. Write a program to perform these tasks: 1. Display the current year, month, and day. 2. Display the current date by using the to String() method from the Date class. 3. Display the current time-which is used to display the number of milliseconds- by using getTime() method from the Date class. We will use it in the step 17. 4. - Display the current year by using get(GregorianCalendar.YEAR) method from to GregorianCale class. 5-…MindTap: In C#, Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers.Which of the following members take values in test object: * Class Test (int xyzı; Static int xyz;; Static int sum(){} Void av(){} }test; а-хуz1 b-хуz2 C- sum d- av e- both a&b
- In Java Create a Cat object passing in the gender and name to the constructor: uses overload Cat constructorIf we do not override the toString method in a class, the toString method for the Object is called. The default output is <class name>@<memory location>. True False//Movie.java import java.util.Arrays; public class Movie { private String movieName; private int numMinutes; private boolean isKidFriendly; private int numCastMembers; private String[] castMembers; // default constructorpublic Movie() { movieName = "Flick"; numMinutes = 0; isKidFriendly = false; numCastMembers = 0; castMembers = new String[10]; } // overloaded parameterized constructorpublic Movie(String movieName, int numMinutes, boolean isKidFriendly, String[] castMembers) { this.movieName = movieName; this.numMinutes = numMinutes; this.isKidFriendly = isKidFriendly; //numCastMember is set to array lengththis.numCastMembers = castMembers.length; this.castMembers = castMembers; } public String getMovieName() { return this.movieName; } public int getNumMinutes() { return this.numMinutes; } public boolean getIsKidFriendly() { return this.isKidFriendly; } public boolean isKidFriendly() { return this.isKidFriendly; } public int getNumCastMembers() { return this.numCastMembers; } public…
- A mountain climbing club maintains a record of the climbs that its members have made. Information about a climb includes the name of the mountain peak and the amount of time it took to reach the top. The information is contained in the ClimbInfo class as declared below. The ClimbingClub class maintains a list of the climbs made by members of the club. The declaration of the ClimbingClub class is shown below. You will write implementations of the addClimb method. import java.util.List; import java.util.ArrayList; class ClimbInfo { private String name; private int time; /** Creates a ClimbInfo object with name peakName and time climbTime. * * @param peakName the name of the mountain peak * @param climbTime the number of minutes taken to complete the climb */ public ClimbInfo(String peakName, int climbTime) { name = peakName; time = climbTime; } /** @return the name of the mountain peak */ public String getName() { return name; } /** @return the number of minutes…Computer Science You are required to develop a small chatting application where two or more friends can communicate each other through messages. Create a class Message which has Date d, and message (string). Provide getters/setters, constructors, toString. Create a class Friend having String name, String contact, email and ArrayList of Messages provide getters/setters, constructors, toString addMessage(Message m) method which will add new message to the list. Provide following options to the user using JFrame. Login which will help user login to the application. View Friends (Display List of All Friends) View Messages ( This should display all message of a Friend) Send message (This should ask for friend name and message match the friend name and write that message to the array list).In Java, which condition occurs when the same object appears as both an input and output parameter? copy constructor aliasing operator overloading type conversion