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 diff core interfaces in java collection framework?

The "big two" core Collection interfaces are List and Set. You can usually also count the Map interface, though it doesn't actually implement the Collection interface.

When do you use inner classes?

You use inner classes when you know you'll never need to access that class from anywhere else.

A common use of this is in a linked list implementation:

public class LinkedList {

private class LinkedListNode {

}

}

There's no reason for any other class to have access to your node class, so it should be an inner class.

Can a parent class access the functions of child class?

no, Parent class can not access the members of child class ,but child class can access members of parent class

Write a program in C which has an integer array and its size as parameter and returns the sum of the values of the elements of the elements of the array Write a main function and show its usage?

#include

using std::cin;

using std::cout;

using std::endl;

int main()

{

int sizeOfArray = 5;

int myArray[] = {0};

cout << "Enter elements of array" << endl;

for (int i = 0; i < sizeOfArray; i++)

{

cin >> myArray[i];

}

int sum = 0;

for (int j = 0; j < sizeOfArray; j++)

{

sum += myArray[j];

}

cout << endl << "Sum of " << sizeOfArray << " is: " << sum;

cin.get();

return 0;

}

What are subclasses of container class?

This chapter covers a special type of Component called Container. A Container is a subclass of Component that can contain other components, including other containers. Container allows you to create groupings of objects on the screen. This chapter covers the methods in the Container class and its subclasses: Panel, Window, Frame, Dialog, and FileDialog. It also covers the Insets class, which provides an internal border area for the Container classes.

Define tream blunders computre oriented numerical method?

blunders can occur at any stage of the mathematical process and can contribute to all other components of error. They can avoided only by sound knowledge of fundamental principles and by the care with which you approach and design your solution to a problem...

Once you have downloaded and installed the Java SE JDK Update 26 for Windows how do you open it-It shows up as a folder and it doesn't open java program when clicked on?

The Java Development Kit is not a program designed to be opened up and used, rather it is a folder of command line tools used to compile java programs. If you want to use a program to create/edit java code that automates the compiling process check out NetBeans or Eclipse. Also, if you are trying to open an already compiled java program with it, read the documentation that came with the java application on how to run it.

What if the elements are repeated in binary search?

You will find one of them (not necessarily the first or the last).

What is the difference between association class and abstract class in software designing?

Association class is describing the relationship between classes. An abstract class is just 1 class, provides some abstraction behaviors that may be (but do not have to) derived, overridden from.

What Java header file meaning?

Source code written in Java is simple. There is no preprocessor, no #define and related capabilities, no typedef, and absent those features, no longer any need for header files. Instead of header files, Java language source files provide the declarations of other classes and their methods.

Difference between message oriented middleware and remote procedure call?

Feature MOM RPC

Metaphor post office like Telephone like

Cilent server

time relationships ASynchronous Synchronous

Client server

sequence No sequence server must first comes up

before the client talks to it.

Partner needed No Yes

Message filtering yes No

Load

balancing Single queue is needed Require TP monitor

implement FIFO policy

Performance Slow Fast

Style queued call return

Describe about JDBC architectural overview?

General JDBC Architecture consist of two layers: JDBC API - this provides the application to JDBC manager connection. JDBC driver API - this supports the JDBC manager to driver connection.

How you can restrict the user to input only digits or integers?

import java.util.*;
public class tryint{
public static void main(String[] args){
Scanner s=new Scanner(System.in);
int w;
try{
System.out.print("Input number:");
w=s.nextInt();
System.out.print("Input number is "+w);}
catch(Exception wi){System.out.println("not an integer");}
}
}

What difference between package class and object?

A package is a grouping of similar classes. A class is a blue print for making an object. An object is, well, an object.

Binary search iterative method over recurssive method?

#include <iostream>

#include <conio.h>

int linearSearch( const int array[], int length, int value);

int main()

{

const int arraySize = 100;

int a[arraySize];

int element;

for( int i = 0; i < arraySize; i++)

{

a[i] = 2 * i;

}

element = linearSearch( a, arraySize, 10);

if( element != -1 )

cout << "Found value in element " << element << endl;

else

cout << "Value not found." << endl;

getch();

return 0;

}

int linearSearch( const int array[], int length, int value)

{

if(length==0) return -1;

else if (array[length-1]==value) return length-1;

else return urch( array, length-1, value);

}

it is in c++ language ,u can change it to c by including stdio.h ,printf & scanf.....i think it wud be beneficial

have a look their too. similar program like that and easy understanding

http://fahad-cprogramming.blogspot.com/2014/02/linear-search-program-in-c-using.html

How do you create a constructor to display a message in java?

(a) A constructor is similar to a method, but it has exactly the same name as the class (including the combination of uppercase and lowercase letters).

(b) It is placed inside the class definition.

(c) The constructor is invoked automatically when you create an object based on that class.

(d) To display a message, you can use the command System.out.println("Put message here")

How do you run Java in Windows?

Eclipse is an Integrated Development Environment that can be used to create and run java programs.

a. First we need to download the Eclipse IDE from eclipse's website.

b. Then you need to install the IDE and create a shortcut on your desktop.

c. Click on the shortcut icon in desktop

d. The system will ask you to choose a workspace location. Choose a location in your local pc

e. Eclipse opens default package explorer view. Create a java project

f. Right click on the project and create a new java class

g. Write your code inside the java class

h. Click on the Menu item called "Run" and select "Run As" -> Java Application

i. If your java program has a main method, the Run As - > Java Application will execute your program.

Why must you override the hashcode method while overriding the equals method?

Because, if two objects are supposed to be equal as per the equals() method, then the value returned by the hashCode() method must also be the same. This will not be the case if you override only the equals method and this can have some confusing effects when using those objects with hash related collections. So it is always a good idea to override the hashCode() method if you are providing an implementation for the equals method.

How do you swap classes and objects without using a template function?

You cannot swap classes, you can only swap objects. An object is an instance of a class while a class is a type definition; you cannot swap type definitions.

It is not possible to write your own version of the swap algorithm without using templates. You can certainly write a function to cater for a specific type of object, but then you'd need to overload it in order to cater for all possible object types, which is clearly impossible since you have no knowledge of my objects let alone anyone else's.

Program to find out position of digit from a number?

class position//Finds the position of the digit of the number

{
public static void main(String...args)
{
System.out.println(pos(1536,6));
}
static int pos(int n,int m)
{
int i=0,rev=0,r;
while(n>0)
{
r=n%10;
rev=rev*10+r;
n=n/10;
}
while(rev>0)
{
r=rev%10;
if(r==m)
{
i++;
break;
}
rev=rev/10;
i++;
}
return i;
}
}


output:
4

What are two types of image management programs?

There are two types of images you can work with, vector images and pixel(raster or bitmap images).Vector based software are Adobe Illustrator, CorelDraw and you can work both image types, but you have more capabilities to work with vector images, primer for pixel based software is Photoshop in which you can also work with both image types but you have more capabilities to work with pixel images.

What is the meaning of minimizes the within-class variability while at the same time maximizing the between-class variability?

minimizes the within-class variability while at the same time maximizing the between-class variability.

What is this native code and what is difference between native code and machine code?

They are the same thing. Every machine type has its own version of machine code, the native language of the machine (native machine code). All high-level code must be converted to native machine code before it can execute. Machine code is machine dependent but high-level code is generally machine-independent, thus the same source code can generally be converted to suit any type of machine using a suitable compiler or interpreter.