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 Different between bit array and jagged array?

A bit array is a kind of array data structure that stores a sequence of bits or boolean values as an array. It is also called a bitset, bitmap or bitstring.

A bit is the basic unit of data in computer science. The bit represents one of two possible values( 0 or 1, True or False, Yes or No) of a logical condition in the form of 0 and 1.

An example of an eight-bit array is 10011100.

A jagged array is a special kind of multidimensional array that stores a collection of arrays of variable sizes. Each row of the jagged array contains columns of different sizes. It is also called as a ragged array. This implies that you can create an array with each element serving as a pointer(reference or link) to another array of the same type.

Consider an example of a 2D matrix of size 3 X 3. One can say that the rectangular collection of size 3 X 3 will have 3 rows and 3 columns, but this is not the case with jagged arrays. In the case of jagged arrays, the number of rows is fixed, but the number of columns may not be fixed.

The differences between a bit array and a jagged array are as follows:

Array Elements: The elements of a bit array are digits( only 0 and 1), whereas the elements of a jagged array are arrays of variable size.

Example of a bit array: 11011100.

Example of a jagged array:

int jagged_arr[][] = new int[][]{

new int[] { 1, 5, 6, 4 },

new int[] { 2, 3},

new int[] { 9, 8, 7},

};

Dimensionality: A bit array is generally one-dimensional but can be represented as two dimensional bit array. On the other side, a jagged array is a multidimensional array.

Size: The size of the bit array is fixed, whereas the column size of the jagged array may not be fixed.

Complex: A bit array is a simple array data structure, whereas a jagged array is more complex than a bit array.

Parallelism: Bit-level parallelism is possible in a bit array, whereas it is not possible in a jagged array. The bit-level parallelism enables long-term storage and manipulation of small arrays of bits in the register set. It also maximises the use of cache data.

Speed: Jagged array is faster than a bit array since the traversal is faster in jagged arrays than in single or multi-dimensional arrays.

Compactness: The bit arrays have a variety of uses in areas where the efficiency of the system or required space is at a premium due to their compact design. On the other side, the design of jagged arrays is not compact, but they have a flexible design.

Uses: One can use the bit arrays for priority queues and boolean flags. A bloom filter is a hash-based probabilistic data structure to determine if a given element is a component of a set.

A jagged array is mainly used for memory management and faster code execution.

What is syntax in java programming?

In Java programming, syntax refers to the set of rules that govern how the code is written and structured. These rules determine how Java source code must be written to be considered valid and to compile without errors. Some examples of syntax rules in Java include:

Every statement must end with a semicolon (;)

Keywords such as "public", "static", and "void" must be written in lowercase

Curly braces ({}) must be used to group statements into code blocks

Variable names must be unique and follow specific naming conventions

Comments are used to explain the code and are written using two forward slashes (//) or enclosed in a block using /* */

Adhering to the correct syntax is important in Java programming as it ensures that the code is readable, maintainable, and can be easily understood by other developers. It also helps to avoid errors and bugs that can arise from incorrectly formatted code.

For more information, please visit: 1stepGrow

What is the example of affordable method?

When a company focuses on what they can afford, or what they think they can afford, for promotion and advertising, this is the affordable method. Many small businesses use the affordable methods such as social networking, flyers, online video advertising, or pay per click advertising.

If statement that multiplies pay rate by 1.5 if hours is greater than 40?

// If statement
if(hours > 40)
payrate *= 1.5;


// Single statement using ternary operator
payRate *= (hours>40)?1.5:1.0;

What is method overloading?

Method overloading is when you have multiple methods in a class that have the same name but a different signature.

Ex:

public void print (String s){

}

public void print(int a) {

}

If we use more than one same type of method but different parameters or parameter list with same no. of parameters within same class than it is called methodoverloading.

if we use more than one different type of method within same class than we dont call it method overloading

for example:

public void add(int a , int b){

systemout.println(a+b);

}

public void add(double a , double b){

systemout.println(a+b);

}

public void add(string a , string b){

systemout.println(a+b);

}

What is the pane in which the Java programming statements are located called?

The pane in which the Java programming statements are located is called

What does equals equals mean in java?

operator to compare two objects.

The simple "=" sign is used for assignment - assigning a value to a variable. Here are examples of the two: x = 15; // Assign the value 15 to the variable if (x == 10) ... // Compare variable "x" with some value

In java how the class containing main is executed with out creating an object?

You may know that static methods in Java are executed even before the constructor of that class are called.

Similarly, since the main method is static it gets executed first even before the others methods of the class are called. Since it is being called before the constructor, logically speaking you cannot have objects of that class.

When you pass an array element to a method the method receives?

Yes, you can use array-elements as parameters. Do you have any problem with that?

Why you use Loops?

Loops are used to repeat the execution of the same set of instructions again and again in a program.

What is an initialization statement?

When a declared variable receives a value to hold.

i.e.

int lalalala;

lalalala = 0; //initialization of lalalala

What is package Explain steps to Create Package?

you intend to create a document using word processor package. explain the steps you will follow and the tools and features provided by the application you will apply

How do you convert jar to nes?

there is no way to convert jar to nes....

I Think theres a way to convert nes 2 jar

What are super objectives?

I am fair sure it is what drives or motivates a character. For example if your character is a firefighter then his super objective is to put out fires.

Why you start java program by class?

without class non of the folder can run so the java program should start in class we can use the class without object in java

The main method of a program has?

The Java main method of a program is the place where the program execution begins. A main method would look like below

public static void main(String[] args){

}

What is inline thread in java?

You can start a thread "inline" without implementing Runnable or extending Thread class

( new Thread() { public void run()
{
// do something
} } ).start();

What is adapter in programming language?

An adapter is a class that subclasses a commonly used class or interface with reasonable default functions provided. For example, the WindowAdapter provides a quick solution that provides default do-nothing functions for 4 common interfaces that a GUI would use. Typically, a developer only needs one or two functions from WindowEvent, for example, but without an adapter, they are required to implement seven functions (with five or six of them "do-nothing" functions), instead of just using an adapter and providing the one or two function bodies they do need.