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

What are the three parts of simple empty class?

Three parts of a simple empty java class are;

  1. A simple empty class of java supports legacy, as it automatically acquires object class, therefore can produce the functionality described in the object hierarchy.
  2. It automatically generates a fault constructor inside the class with a blank description.
  3. It also accompanies polymorphism, as can be practiced in any scheme by the extensive class.

How do you write a java program to check a number is twisted prime or not?

To write a Java program to check if a number is a twisted prime or not, you first need to create a function that checks if the number is prime. You can do this by iterating from 2 to the square root of the number and checking if the number is divisible by any of these values. Once you have verified that the number is prime, you can then check if the number remains prime after twisting its digits (reversing the number and checking if the reversed number is also prime). If both conditions are met, then the number is a twisted prime.

What is the Difference between header file and package?

A header file is a file in C and C++ programming languages that contains function declarations and macro definitions that can be shared across multiple source files. It typically has a .h extension. On the other hand, a package is a collection of related classes, interfaces, and sub-packages in Java programming. Packages provide a way to organize code and prevent naming conflicts. In summary, a header file is specific to C and C++ languages, while a package is specific to Java.

Complex assignment in java?

An Assignment operator in Java is the operator that is used to assign a variable a value.

if you declare

int x = 10;

then the value 10 is assigned to the variable x. here the "=" symbol is the assignment operator.

What is Siwoloboff method - slide6?

Siwoloboff's method is a method used to establish the boiling point-composition curve of a binary system. It is particularly well adopted for the determination of boiling points of small samples of pure liquids and of mixtures.

In this method, the open end of a short capillary tube (sealed at the other end) is immersed in the liquid under investigation. The tube serves as a manometer to determine the temperature at which the vapor pressure ofthe liquid is equal to the pressure of the atmosphere (boiling point definition)

What is dynamic billboard applet?

A dynamic billboard applet is a software application that displays changing content on a digital billboard or signage. It allows for real-time updates and customization of the displayed information, such as advertisements, announcements, or event schedules. The applet typically utilizes programming languages like HTML, CSS, and JavaScript to dynamically render and refresh the content on the billboard based on predefined parameters or user interactions.

Java program to demonstrate multiple inheritance?

Inheritance is one of the building blocks of Java and it is used extensively in all java based applications. Inheritance is everywhere in Java. I can't think of one java project that I worked on, where inheritance wasn't used.

Inheritance is the feature wherein the properties/qualities of a parent class or interface is used in the child class. Both Classes & Interfaces are used in Java Inheritance

What is the method for 883 divided by 8?

Well, darling, to solve 883 divided by 8, you simply do the math. 8 goes into 88 eleven times, so you put 11 above the 8. Subtract 88 from 88 to get 0, bring down the 3, and 8 goes into 33 four times, giving you a total of 110. Voila, the answer is 110 with a remainder of 3.

What is similarities between interface and classes?

The similarities are:

a. They are both java basic object types

b. They both can contain variables and methods (With difference being class methods have implementation code whereas the interface methods can only have declarations)

c. They can both be inherited using Inheritance (extends keyword for classes and implements keyword for interfaces)

What is dynamic method dispatch in java?

Dynamic Method Dispatch in Java is when a method call is resolved at runtime based on the actual object the reference points to.

For example, if a parent class has a method and a child class overrides it, a parent reference pointing to a child object will execute the child’s version of the method.

This allows Java to decide which method to run during execution, enabling runtime polymorphism.

To dive deeper into this topic, visit the Uncodemy blog for detailed insights.

How do you map the object oriented concept using non object oriented languages?

Object oriented programming doesn't strictly require an object-oriented programming language (although those are generally best suited for the job).

Object orientation, as a concept, means to create logical representations of physical or conceptual items: a vehicle, a person, a manager, etc. Each object type (commonly called a class) has a bundle of attributes (data items, properties) and verbs (methods, functions). These bundles, together, form the class.

It is thus possible to create constructs very close to modern classes as those known in C++ using structures in C. In fact, the first C++ compilers (~20 years ago) translated C++ into C, then used an existing C compiler to generate executable code.

In C, a structure can

  • contain variables (data members)
  • pointers to functions (member functions)
  • pointers to pointers of functions (virtual functions)

Among the many standard object-oriented techniques which can not be modeled in C are

  • privacy through visibility keywords (public, private, protected)
  • inheritance (but a "derived" class can embed the "superclass" for a similar effect)
  • polymorphism
  • contracts (interfaces)
  • operator overloading

That said, object orientation as a design concept does not require an object oriented language.

Select the odd one out.a Java b Lisp c Smalltalk d Eiffel?

Oh, dude, selecting the odd one out is like choosing the black sheep of the programming family. In this case, Lisp is the odd one out because it's the only one that doesn't start with a J. But hey, they're all cool in their own nerdy way, right?

What are two occupations that match the keyword doctors?

Two occupations that match the keyword "doctors" are physicians and surgeons. Physicians are medical professionals who diagnose and treat illnesses and injuries, while surgeons specialize in performing surgical procedures to treat various medical conditions. Both occupations require extensive education and training in the medical field.

Write a programme in bluej to accept two numbers and check whether they are twin prime or not.?

class Twin_Prime

{

void Prime(int n,int m)

{

int a=0;

int b=0;

for(int i=1;i<=m+n;i++)

{

if(m%i==0)

{

a=a+1;

}

if(n%i==0)

{

b=b+1;

}

}

if(a==2)

if(b==2)

{

if(m-n==2)

{

System.out.print("The numbers "+m+" and "+n+" are Twin Prime");

}

else

if(n-m==2)

{

System.out.print("The numbers "+m+" and "+n+" are Twin Prime");

}

}

else

{

System.out.print("They are not Twin Primes");

}

}

}

What is the relationship between ICT and computer?

Information and Communication Technology (ICT) is a broad term that encompasses the use of various technologies for communication and data processing. Computers are a key component of ICT, as they are used for processing and storing data, as well as for communication through networks. In essence, computers are a fundamental tool within the realm of ICT, enabling the processing, storage, and transmission of information across various digital platforms.

In java write a program to check whether the number is even or odd and take the range from 1 to 50?

import java.util.Scanner;

public class ColEvenOdd{

public static void main (String[]args){

Scanner kb = new Scanner (System.in);

System.out.println("Enter the limiting number");

int no = kb.nextInt();//Here put the 50

System.out.println();

int i,j;

if(no==0){

System.out.println("ODD"+'\t'+"EVEN");

System.out.println(" "+'\t'+" 0 ");

System.exit(0);

}

if(no==1){

System.out.println("ODD"+'\t'+"EVEN");

System.out.println("1");

System.exit(0);

}

if(no>1){

System.out.println("ODD"+'\t'+"EVEN");

if(no%2==1){

for(i=1; i<=(no-2); i+=2){

System.out.println((i)+" "+'\t'+(i+1));

}System.out.println(no);

System.exit(0);

}

if(no%2==0){

for(j=2; j<=no; j+=2){

System.out.println((j-1)+" "+'\t'+(j));

}System.exit(0);

}

}

}

}

Give an example source code to find the given number is even or odd using method overloading in java?

The following will return true if the number provided is even: boolean isEven(int number) { return number % 2 == 0; } Repeat for other integral data types (such as long), and you have method overloading.

The following will return true if the number provided is even: boolean isEven(int number) { return number % 2 == 0; } Repeat for other integral data types (such as long), and you have method overloading.

The following will return true if the number provided is even: boolean isEven(int number) { return number % 2 == 0; } Repeat for other integral data types (such as long), and you have method overloading.

The following will return true if the number provided is even: boolean isEven(int number) { return number % 2 == 0; } Repeat for other integral data types (such as long), and you have method overloading.

How do you check whether the given number is Armstrong or not?

First, review the definition of an Armstrong, or narcissistic, number:

"...is a number that is the sum of its own digits each raised to the power of the number of digits."

So, you need to count the digits (to know what power to use), and extract the individual digits. This can be done in several ways; for example, you might convert the number to a string. In Java:

String numberAsString = "" + number;

Now it should be easy to figure out the length of the String (use the .length() method), and to extract the individual digits - check the methods available for strings. Then you need to convert the digits back to numeric data.

Another way is to get one digit at a time, starting from the right, using the "%" operator.

For example, 153 % 10 is equal to 3. Divide the number, 153, by 10 (integer division), then repeat to get the remaining digits. You might store the digits to an array.

First, review the definition of an Armstrong, or narcissistic, number:

"...is a number that is the sum of its own digits each raised to the power of the number of digits."

So, you need to count the digits (to know what power to use), and extract the individual digits. This can be done in several ways; for example, you might convert the number to a string. In Java:

String numberAsString = "" + number;

Now it should be easy to figure out the length of the String (use the .length() method), and to extract the individual digits - check the methods available for strings. Then you need to convert the digits back to numeric data.

Another way is to get one digit at a time, starting from the right, using the "%" operator.

For example, 153 % 10 is equal to 3. Divide the number, 153, by 10 (integer division), then repeat to get the remaining digits. You might store the digits to an array.

First, review the definition of an Armstrong, or narcissistic, number:

"...is a number that is the sum of its own digits each raised to the power of the number of digits."

So, you need to count the digits (to know what power to use), and extract the individual digits. This can be done in several ways; for example, you might convert the number to a string. In Java:

String numberAsString = "" + number;

Now it should be easy to figure out the length of the String (use the .length() method), and to extract the individual digits - check the methods available for strings. Then you need to convert the digits back to numeric data.

Another way is to get one digit at a time, starting from the right, using the "%" operator.

For example, 153 % 10 is equal to 3. Divide the number, 153, by 10 (integer division), then repeat to get the remaining digits. You might store the digits to an array.

First, review the definition of an Armstrong, or narcissistic, number:

"...is a number that is the sum of its own digits each raised to the power of the number of digits."

So, you need to count the digits (to know what power to use), and extract the individual digits. This can be done in several ways; for example, you might convert the number to a string. In Java:

String numberAsString = "" + number;

Now it should be easy to figure out the length of the String (use the .length() method), and to extract the individual digits - check the methods available for strings. Then you need to convert the digits back to numeric data.

Another way is to get one digit at a time, starting from the right, using the "%" operator.

For example, 153 % 10 is equal to 3. Divide the number, 153, by 10 (integer division), then repeat to get the remaining digits. You might store the digits to an array.

How do you find greatest number among three without conditional operator and Math Library Functions?

import java.io.Writer;

import java.util.Scanner;

public class Teknoturf {

public static void main(String[] args) {

System.out

.println("This is Print Greater No without Using '<' '>' symbol and Math Library");

Scanner scan = new Scanner(System.in);

System.out.println("Enter No1------------->>");

int no1 = scan.nextInt();

System.out.println("Enter No2------------->>");

int no2 = scan.nextInt();

System.out.println("Enter No3------------->>");

int no3 = scan.nextInt();

Utility(no1, no2, no3);

}

static void Utility(int a, int b, int c) {

int temp = 0, temp1 = 0;

Integer AminusB = a - b;

String strAminusB = AminusB.toString();

if (strAminusB.substring(0, 1).equalsIgnoreCase("-")) {

temp = (a + b) / 2 - -(a - b) / 2;

} else {

temp = (a + b) / 2 - (a - b) / 2;

}

temp1 = a + b;

temp = temp1 - temp;

int help1 = temp - c;

Integer tempMinusC = temp - c;

String strtempMinusC = tempMinusC.toString();

if (strtempMinusC.substring(0, 1).equalsIgnoreCase("-")) {

temp1 = (temp + c) / 2 - -(temp - c) / 2;

} else {

temp1 = (temp + c) / 2 - (temp - c) / 2;

}

temp = temp + c;

temp1 = temp - temp1;

System.out.println("Greatest Number----------------------->>" + temp1);

}

}

this is only work for positive numbers ....

Thanks and Regards,

P.Marimuthu

www.teknoturfian.blogspot.com

Java programme to find area of a circle?

well, the formula is A=pi(r)^2 r=radius A=area ^=to the [insert number here] power pi=3.14...

What is the only integer that can be assigned to a string?

If you wanted to ask 'Which is the only numeric value that can be assigned to a pointer?', then the answer would be: 0.

Can a degree be used in multiple country's?

yes, your degree will be valid in any country. however, lisencing is different. you may need to obtain certain lisences depending on which country and field you are practicing in.