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

Write a java program for sum of n numbers?

This is a very simple problem, alnost certainly a homework problem, and you should make an effort to answer it yourself.

How do you extract digits from an integer in java?

There are different ways to do it.

One is to convert it to a String, then use the string manipulations methods to extract individual digits as strings. You can then convert them back to numbers.

Another is to do some calculations. For example, to get the last digit:

int i = 12345;

int lastdigit = i % 10;

//To get additional digits, divide by 10 and repeat:

i /= 10;

int lastdigit = i % 10;

In this case you can create a loop for this (repeating while i > 0), and copy the digits to an array.

Write a java program to sort a list of numbers?

The simplest would be to put the numbers into an int[] (integer array) and pass that to java.util.Arrays.sort(int[]) (a static method), which will sort the array in ascending numerical order. Use a float[] or double[] if you need to sort non-whole numbers. You can also use the Collections.sort(List) method to sort the List directly. Or the Collections.sort(List, Comparator) if you wish to specify your own sorting criteria.

What are the various functions in iterator class in java?

There are mainly three Methods available in the iterator class in java.

Namely they are ...

1. Has Next

2. Next and

3. Remove.

What is the class of the standard error output as found in the static field of the System class java.lang.System.err?

The static field java.lang.System.err is än object of type java.io.PrintStream.

The default value of System.err is new FileOutputStream(java.io.FileDescriptor.err).

For details, view the source code of System class and review the private initializeSystemClass() method.

What is difference between context-param and init-param in J2EE?

context-param defines values for the entire web application, and init-param defines values for individual components sutch servlets and filters.

init-param tag is used to specify initial parameters for specific servlets.context-param is also used to specify initial parameters ,but this can be used by different servlets sharing the same context.servlets outside the context can use it but first of all they need to get access to the specific servletContext.

What is a foreach loop?

A foreach loop takes an array, and goes through the loop you specify - each time, it goes to the next index of the array. When it has gone through every index, the script continues. This can be useful to retrieve data from a database, and insert it into a table, list, or into general content space, or to easily manipulate all the data in an array. The syntax varies depending on the programming language you are using.

What are the component containers that ship with the Windows Server Family?

System.Web.UI.Page, System.Windows.Forms.Form and System.ComponentModel.Container

The essence of component development is not to build what you can buy. Buy a rich text web control from the market for $99 instead of design and implement one from scratch. Snapping together pre-tested components are faster, cheaper and probably more reliable than coding everything for yourself.

What is a '.NET component'? Arguably, almost any .NET class file is a component, in that it can easily be compiled to a DLL, it benefits from .NET versioning, and it can be reused. If you narrow the definition to components that are 'designable', in other words you can drop instances onto a Visual Studio .NET design surface and set their properties or create event handlers visually, then you need a class that directly or indirectly implements IComponent. Designable objects do not necessarily have a user interface. Those that do are controls as well as components, and inherit from System.Windows.Forms.Control or System.Web.UI.Control.

The existence of components also implies the existence of containers, which again may be visual or non-visual. In the .NET Framework both ASP.NET Web Forms and rich client Windows Forms are visual component containers. The container plays an important role in component management. In particular, all containers implement IDisposable, which means they have a Dispose method for releasing unmanaged resources such as window handles or open files. In their Dispose method, containers must also call Dispose on all the components they host.

How do you make a BINGO card using Java 3.0 that when you run again the number in the bingo card will not be seen again..it would be in random?

I don't know about Java 3.0 but with the current version of Java 5.0 The Random class could be used or the Math.random() method (which really uses the Random class).

The way I would approach this after getting the random number generator down is to make a class to be the Bingo Card, perhaps implemented with an instance of a 2D Array (an Array of Arrays) to hold each number, perhaps a 2D array to hold whether each box is stamped, and a method to check whether I have a bingo.

If you have questions about 2D Arrays and how to manipulate them check out the link below.

What is gini in Java language?

gini is the one type of extension of the java.

gini is the advanced and advanced version of the java

Why java is 'simple'?

java is similar to c/c++,easy to learn if you have some programming experience.

and also the developers omitted the concepts of pointers(which are very difficult) in java

When java is developed,developers want it to be simple because it has to be work on electronic devices.Where less memory is available.

Which three statement are true regarding the encapsulation an de-encapsulation of packets when traveling through a router?

** The router modifies the TTL field, decrementing it by one.

** The router maintains the same source and destination IP.

** The router changes the source physical address to the physical address of the exit interface

Why do you need to private part of a class and how to access them?

You don't need to make any part of a class private, but then it would behave no differently to a struct, which is public by default. The point of private access is to hide data and methods that are internal to the class; you are not supposed to be able to access them from outside the class.

There are three levels of access: private access is only accessible to the class itself, and to friends of the class. Protected access is the same as private, but is also accessible to derived classes. Public access is accessible to all.

To give an example, imagine the following structure:

struct s

{

unsigned int num;

};

Suppose the num member can be any positive value but must never be zero. That means that whenever we pass this structure to a function, we must assert or verify that num is non-zero. We are relying on those functions to perform verification that should rightly be performed by the structure. But num is public, so there's really no way to safeguard against the structure containing invalid data.

So let's replace the structure with a class:

class c

{

public:

c():num(1);

void setnum(unsigned int number){if(number !=0 ) num = number;}

unsigned int getnum()const{return( num );}

private:

unsigned int num;

};

Now we can be sure that num is never zero. The constructor automatically sets num to positive 1, and the setnum mutator only changes num if the given number parameter is non-zero. Meanwhile, the getnum accessor returns a copy of num, not a reference to num. Only the class itself has access to the private num variable, thus the data is hidden from outside influence, and the public interface guarantees that num will always be non-zero. We no longer need to verify this fact because that functionality is encapsulated within the class itself, where it belongs.

What is parseInt in BufferedReader in java?

parseInt() interprets the next available token as an int.

What are some common uses of Java powered IDEs?

There are many common uses for Java powered IDEs, or integrated development environments. This type software application is often used by programmers to edit source code or program am automation.

How do you code a simple dictionary?

You can create a dictionary using the HashMap class and store words and their meanings as pairs.

Decrement operators programing in java?

The decrement operator is simply the double minus, attached to a variable:a--;

or:

--a;

The two examples above are identical, and both are equivalent to:

a -= 1;

or:

a = a - 1;

However, if the decrement operator is used as part of more complicated expressions, in the --variable version, the decrement is done before anything else, while in the variable-- version, the decrement is done after anything else.

Which is the most common encapsulation in use on BRI Interface?

Which is the most common encapsulation in use on BRI Interface ? A. SDLC B. ATN C. HDLC D. PPP

What is wrong with not writing a return statement in value-returning method in java?

It is a syntax error, because a value returning method must return a value, and not writing a return statement with a value is tantamount to returning without a value.