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

How do you reverse a string while maintaining the first letter at the beginning and at the end?

class R

{

public static void main(String args[])

{

String s="vikrant";

String s3="";

char ch[]=s.toCharArray();

char s1=ch[0];

char s2=ch[0];

for(int i=ch.length-2;i>=1;i--)

s3+=ch[i];

System.out.println(s1+s3+s2);

}

}

for more: kumar976001@gmail.com

How can iwrite java program to print programming in triangle form?

public class equitraingle {

public static void main(String[ ] args) {

int numrows=6; // changing the value of numrows,respective o/p will be printed

for(int i=1;i<numrows;i++){

for(int j=1;j<numrows-i;j++)

{

System.out.print(" ");

}

for(int k=1;k<=i;k++){

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

}

System.out.println("");

}

}

}

o/p:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

What is the ministerial exception?

The term ministerial exception is the law that says that the government cannot regulate the religious institutions and their hiring processes. For example, if a Christian or Catholic school has rules about not hiring homosexuals the government cannot enforce discrimination laws.

What will be a simple program to explain object in java?

This is the Num objects class

public class Num{

public int number; // makes the integer that will store the number

public Num(int a){ //constructor

number = a; //number being stored

}

public void setNumber(int b){ //New Method that will edit number

number = b;

}

public int getNumber(){ //New Method that will return number

return number;

}

}

This is the class that edits and add the object

public class FindNum{

public static void main(String[] args){

Num example = new Num(5); //creates an object of the class Num and sets the int number to 5

example.setNumber(7); //set the new value to 7

System.out.print(example.getNumber()); //returns the value and prints it

}

}

What is public static final variable in java?

-Public to all

- Static to access with Class Name

- Final to change( constant and not alowed to change)

Just use it along with class name.

(As implied above, a 'public static final' variable in Java is what other languages would call a Constant. )

What data type can store a variable amount?

This all depends on the value you want to hold. A byte, short, int and long all store integers with increasing upper limits, respectively. Floats and doubles hold numbers with mantissas, decimal places. Booleans hold true or false values. Characters hold a character (alpha-numeric values). Strings (not primitive data types but treated as such) hold a list of characters.

What are predefined codes?

Predefined codes or the predefined functions are the codes small or large codes which are predefined by the maker of the language. In C++ the predefined codes can be included in the program by the header files. These codes are placed in files and functions could be used to access them. Like a simple console Code to output "Hello World" uses a predefined code cout<<"Hello World"; so this cout is already defined how it prints the text or much more know function from C language print( ); .

What are java crud operations?

CRUD stands for Create, Read, Update, and Delete. Any application or operation that can be specified to do the items listed below is call and CRUD application or Framework. Java like other programs is in a way a framework that allows you to do these operations on an entity such as a database.

What is recitation method?

It is a method used by the teacher to enhance the oral skills of the learner and to keep in memory by reciting the content.

What is a neon number?

a neon number is that where

sum of digits of square of the number is equal to the number ...

for example --

sample input => 9

sample output =>

9*9 = 81,

8+1=9

therefore,

9 is a neon number

PRACTICALLY, THERE IS NO OTHER SUCH NUMBER...

ITS ONLY A THEORETICAL CONCEPT OF NEON NUMBERS !!

What types of data used in algorithm?

Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.

Why don't use abstract keyword when we declare a method in interface?

The abstract keyword signifies that the particular method will have no features in the class where it is declared and it is upto the child class to provide the functionality.

In case of an interface, the method is already abstract by default and has no code inside it. So there is no actual point in using the abstract keyword there.

How do you use set and get in object-oriented programming?

A set function (or setter) is an object mutator. You use it to modify a property of an object such that the object's invariant is maintained. If the object has no invariant, a setter is not required.

A get function (or getter) is an object accessor. You use it to obtain a property from an object such that the object's invariant is maintained. If the object has no invariant, you do not need a getter.

Why would a thread ever voluntarily give the CPU by calling a thread-yield?

Theoretically a thread will give up its CPU time voluntarily by using the yield feature. But practically, the programmer will write the code and make the thread give up its CPU time. So it is not a voluntary act from the threads perspective. It is just doing it because the programmer made it do so.

What is java BDK?

Beans Development Kit

It is used for running the beans with graphical.

Can you restart stopped thread in java?

No. Once a thread is stopped you cannot restart it.

What is the difference between robustness and reliability and how design affects such characteristics?

Reliability is related with failure, i.e., how long it is expected that component or system will work perfectly as stated without failure or error.

Robustness is ability of system or component to perform as expected under erroneous, stressful, or unexpected inputs or conditions (in perturbations)

Can we implement multiple inheritance in java using package and interface?

Yes. Java does not support full fledged/proper multiple inheritance. But, whatever partial inheritance that Java supports can be implemented using interfaces

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces.

Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…}

And this is under the assumption that Car and Automobile are interfaces.

Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.

Is reader class is an abstract class?

For Java: Yes, Reader is an abstract class in package of java.io;

For C#: No, Reader is NOT one of the defined library classes. Of course you create one.

What is non nested loop?

Example:

for (i=0; i<argc; ++i) {

print ("%2d. '%s'\n', i, argv[i]);

}

What is the benefit of float data type?

Floating type numbers can't be stored in integer type variables. If we do that then their fractional part will be lost. So, we use float data type to store numbers with fractional parts.

Where can you read books online for free without downloading them?

In most instances, you do need to download books from a particular source to read them. You don't need to be worried about using up memory on your device. When you borrow ebooks from libraries, the book will automatically be deleted from your device when your time expires, so it won't take up your memory.

Google Books does have a selection of books that you can read online without downloading. Some of the books are of higher digital quality, while other books have just been scanned in. This is a good place to start if you have something specific you're searching for.

Project Gutenberg is another great place to read books online without downloading.