answersLogoWhite

0

📱

Java Programming

The Java programming language was released in 1995 as a core component of the Java platform of Sun Microsystems. It is a general-purpose, class-based, object-oriented language that is widely used in application software and web applications.

5,203 Questions

Various integrity rules in a DBMS?

Three basic types of database integrity constraints are:

  • Entity integrity, not allowing multiple rows to have the same identity within a table.
  • Domain integrity, restricting data to predefined data types, e.g.: dates.
  • Referential integrity, requiring the existence of a related row in another table, e.g. a customer for a given customer ID.

Quantitative variables can be separated into what two types?

nominal and ordinal is wrong; those are the two types of qualitative variables. Ratio and interval are the two types of quantitative variables.

Is it possible to override overloaded methods why?

Yes. Overloaded methods are also Java methods and all Java methods can be overridden.

Can additional methods of base class be hidden from the derived class in object oriented software?

Yes. During inheritance only the public members of the parent class are visible to the child class. If you declare a method or a variable as private, the child class cannot access it. In other words, the methods and variables are hidden from the derived class.

How do you remove java platform SE binary?

Don't Do it, Otherwise you won't be able to play Minecraft, and some other things that use java

Define method overloading and write two method headers that together exhibit overloading?

Method overloading is when two or more methods have the same name, but the computer can differentiate between the methods by looking at the parameters.

Example:

public static void go(int x)

public static void go(double x)

If you pass an int, the first method would be called. If you pass a double, the second method would be called

What does the native keyword do in Java?

The native keyword is used to tell Java that the method you are defining is actually implemented in machine-specific compiled code outside of Java.

It is mainly used to import existing libraries of code compiled in C into Java, but is also used for the "low level" stuff which must be written specifically for each platform. If you try to look through the Java source code for how things like Sockets or the Math class are implemented, you will soon run into native methods.

See the related link below for a well written example of how to use native methods yourself.

Check whether two values or equal or not without using if?

// prob not what you are looking for since it just eliminates the if statement but

// is still using a boolean operator

bool areEqual = (value1 0);

You might want to clarify the question. Can you use boolean operators? I don't know how you can get around that.

What is the difference between CTAB and SDS method?

This refers to the type of detergent used to lyse cell membranes when extracting DNA from cells. SDS=Sodium dodecyl sulfate, CTAB=Cetyl trimethylammonium bromide

What is the J2EE Business Delegate Pattern?

The Business Delegate pattern reduces the dependency between tiers. It is an attempt to make tiers interchangeable so one can access or utilize the services of any other.

This pattern is a proxy that hides the complexity of remote service lookup and error recovery. It makes it easier to communicate requests and results from one layer to another.

This is not a pattern for a layer itself. It isn't a way for you to create a business logic component or structure. Rather, it is an interface to a tier so that you can change the underlying components and not disturb the presentation tier.

This pattern is like an ambassador. Like all good ambassadors, it can pass on the message from the host country to any other.

WHAT ARE THE ANSWERS TO Interview qusTions?

You know i have no idea but we can find out by putting the ideas at hand so don't give up! Any way you that made this Q you are very smart

Why main method only called by jvm why not any other our own static method?

At the time of developing jvm the development team by default make a only one method call i.e; 'main' method call in the jvm that's why when the call is loading into the jvm the jvm call the main method...and execution was starts..

Difference between inheriting a method and overriding?

Inheriting a method means - a class is able to use a method that is declared in its parent class. Because of inheritance we need not re-declare the method in the child class again but still use it as it is. Overriding means re-declaring a method that is already available in the parent class in the child class to alter its features as per the requirement in the child class.

Sum of all the digits of a number for while loop?

#include<stdio.h>

void main()

{

int n,sum=0;

clrscr();

printf("enter the value"):

scanf("%d",&n);

do

{

sum=sum+n;

n=n-1;

printf("sum is %d"<sum);

}

while(n>0)

getch();

}

Is check a keyword in java?

No, 'check' is not a keyword in java language.

What is a static plan?

A static plan is a fixed, unchanging course of action that outlines specific objectives, resources, and timelines for achieving goals. Unlike dynamic plans, which can be adjusted as circumstances evolve, static plans remain consistent throughout their implementation. They are often used in situations where outcomes are predictable and less likely to change, providing clarity and focus for teams and organizations. Static plans can be beneficial for long-term projects but may lack flexibility in responding to unforeseen challenges.

What is concatetion operation used in java?

"+" is the concatenation operator in Java. It can be used to concatenate two strings.

Ex:

String firstName = "John";

String lastName = "Morrison";

System.out.println(firstName + " " + lastName);

The above code snippet would display John Morrison in the console.

In Java what operator is used to determine if an object is of a particular class type?

The instanceof keyword is used to determine if an object is of a particular class type.

Example:

Object obj = new String();

if(obj instanceof String) {

System.out.println("obj is a String!");

}

Does separation of interface from implementation within classes provide advantage?

Yes, it helps both the users and the maintainers of your class. Users are generally only interested the class interface (how to interact with the class), so by separating the implementation you do not distract the user with any unnecessary implementation details. Conversely, maintainers are more concerned with the implementation than the interface. By keeping the two separate, maintainers are much less likely to break any code that uses the class.

Java code to print prime numbers from 1 to 100?

import java.io.*;

class prmNo

{

public static void main(String[] args)

{

Console con = System.console();

System.out.println("Enter length of list :");

int n = con.readLine();

boolean flag;

System.out.print("1 ");

for (int i=2;i<=n;i++)

{

for (int j=2;j<i;j++)

{

if (i%j==0)

flag=true;

}

if(!flag)

System.out.print(i+ " ");

flag=false;

}

}

}

You cannot throw an exception from a destructor?

Sure you can, but it's never a good idea. You must never allow an exception to escape from a destructor. To do so would terminate the destructor prematurely, unwinding the call stack in search of an exception handler. This means that any remaining resources consumed by the instance, including its base classes, would be left in an invalid state with no possible way to recover those resources besides terminating the program. Any object that has the potential to throw an exception during its own destruction should always be treated with suspicion; it is a major design flaw.

What is a sum?

The result of addition.
The answer of all your numbers added up.

If then else statements and case statements essentially perform the same function when would you use one over the other?

I would recommend an If - then - else statement over a switch statement because:

1. It is simpler/easier

2. You do not get unexpected output because of missing break statements

A missed break statement in one of the conditions in a switch case statement means that all the conditions that come after the success condition are executed. In case of if else this is not the case and hence it is much safer for novice programmers.

> essentially perform the same function

No, they don't. Here is an example to prove this:

if (sin (alpha) > cos (alpha)) {

...

} else if (alpha / M_PI * 180 > 180) {

...

} else {

...

}