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 you can store a class variables in array list?

An (non generic) arrayList in java can save any type of object (in this case your class variable) in this straightforward way:

MyClass myClassVar = new MyClass();

ArrayList myArrayList = new ArrayList();

myArrayList.add(myClassVar);

What are the variant records in Java?

In C and C++ Variant Records correspond to Unions. There is no corresponding capability in Java

What is a delegation event model in java?

Event model is based on the concept of an 'Event Source' and 'Event Listeners'. Any object that is interested in receiving messages (or events ) is called an Event Listener. Any object that generates these messages ( or events ) is called an Event Source

Event Delegation Model is based on four concepts:

The Event Classes

The Event Listeners

Explicit Event Enabling

Adapters

The modern approach to handling events is based on the delegation event model, which defines standard and consistent mechanisms to generate and process events. Its concept is quite simple: a source generates an event and sends it to one or more listeners. In this scheme, the listener simply waits until it receives an event. Once received, the listener processes the event and then returns. The advantage of this design is that the application logic that processes events is cleanly separated from the user interface logic that generates those events. A user interface element is able to "delegate" the processing of an event to a separate piece of code.

How can you make object from string in java?

String itself is an object dude...

If you want an object out of a string then you can do this.

Object obj = (Object) str; //str is the String you want to convert to object.

Is space a token in java?

By default, no. The StreamTokenizer class ignores spaces as white space.

If you need to make it a token, which you didn't specify, you can modify the default behavior by calling the function ordinaryChar (int ch), where ch is the character you would want to be treated as a token.

From the Java SE 6 API documentation:

ordinaryCharpublic void ordinaryChar(int ch) Specifies that the character argument is "ordinary" in this tokenizer. It removes any special significance the character has as a comment character, word component, string delimiter, white space, or number character. When such a character is encountered by the parser, the parser treats it as a single-character token and sets ttype field to the character value.

Making a line terminator character "ordinary" may interfere with the ability of a StreamTokenizer to count lines. The lineno method may no longer reflect the presence of such terminator characters in its line count.Parameters:ch - the character.

How do you calculate a Hangman score in Java if the first word is 10 points and each additional word is 2 more points?

Without much context you can create a static class variable and add 10 to it the first time and add 2 to it every other time.

How do you read a value from .pdf file using winrunner TSL scripting?

try with file_open command it will work. if not possible asume that as a image and then using coordinates you can get a value

bye chanti

What is the mean of object identity and classification in terms of object oriented programming?

Well, that's pretty straightforward. An "object" is a named thing with certain properties, like in Plato's "Allegory of the Cave," and "classification" refers to a GROUP of similar things, that all share certain properties. To use a non-programming example, the classification "animals" might include objects like "mammal," "reptile," "bird," and so forth. Or those things might themselves be "classes," depending on your own personal choices and needs. So a "bird" might be a "class" including "objects" like "robin," "thrush," and "starling," with properties like "color of breast," "forked tail," and "temperament."

What is default file name in PowerPoint?

The default file name is Presentation 1

The default file extension is .pptx

How could you count a number how many times present in an array?

You can do this with a simple for loop counting through the array and increasing a tally each time you sought number is hit.:

tally = 0
for each element in the array {
if this element has the value we want{
tally = tally + 1

}

}
output the taly


In PHP for example, this could be done like so:

$tally = 0;
foreach($foo as $bar){
if($bar == $value_sought) $tally++;

}
echo $tally;

where "$foo" is the array you're serching and $value_sought is the number you're looking for.

How many programming languages are based on C?

C++, Java, Perl, Python, PHP, JavaScript, LPC, C# is the most popular languages based on C, but there is probably more languages.

What is the purpose of the default value key?

If you are talking about the Switch statement the default value key is that in which if none of the other case statements are true will be processed.

For example:

Day = "Sat";

switch (day) {

case "Mon": System.out.println("Welcome to the begining of the week"); break;

case "Tue": System.out.println("Day 2 keep it up"); break;

case "Wed": System.out.println("Hump Day"); break;

case "Thu": System.out.println("Almost there"); break;

case "Fri": System.out.println("Another week down have a great weekend"); break;

default: System.out.println("Weekend work again"; break;

}

As we set day to Sat there was no case for Sat and therfore the default key would be used for both Sat and Sun.

Hope this helps

Viruses can be created with almost every languagebut why anyone can't get the complete knowledge for any particular language in collegesinstitutes etc wether thy afraid of giving knowledge?

The reason why colleges and institutes may not provide complete knowledge on creating viruses using programming languages is that it is unethical and illegal to create malicious software. Providing instruction on how to create viruses goes against ethical guidelines and can lead to legal issues. Institutes focus on teaching programming for constructive purposes rather than destructive ones.

A sample code for using password field in java?

We'll look at a simple program which displays a small window containing only a JPasswordField object. When you press the Enter key while editing the password field, we'll print out the password and then change what character is used to mask it.

final JFrame frame = new JFrame("Password Test Frame");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JPasswordField passfield = new JPasswordField();

passfield.addActionListener(new ActionListener() {

// When we press the Enter key, do some stuff to passfield...

public final void actionPerformed(final ActionEvent ev) {

// Print out the underlying password.

System.out.println(new String(passfield.getPassword()));

// Change the character used to mask the password.

passfield.setEchoChar((char) (passfield.getEchoChar() + 1));

}

});

frame.add(passfield);

frame.setSize(300, 60);

frame.setVisible(true);

How do you create DivX file?

== == Great freeware program that has a step-by-step guide you can find in the start menu.

http://www.simpledivx.org/main/

What JDK command is used to run a java application in byteCodeclass?

To run a Java program, you use the following form:

java ClassFileName

ClassFileName is the name of the .class file that you wish to execute. However, you do not type the .class extension.

Why is cross-platform connectivity important to many computer users?

Users want to communicate with one another, without being restricted by incompatibility between different types of computers.

Use the control variable during the execution of the loop?

Control variable which is used in control structures.

e.g. for(int i=0;i<10;i++)

{

// body of loop

}

In above example i is a control variable. The scope of i is only in body of loop.

Out of body the scope of all control variables are lost.

Dry run technique in c language?

dry run is nothing but manual compilation of code with an example for written steps to check whether the code for particular problem is solving or not.....if it not happens change code accordingly...........

What happens if you don't initialize an instance variable of any of the primitive type in java?

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0(zero), a Boolean will be initialized to false.

Declare and initialize 2D array in java using two statements- one to declare variable the other to initialize elements?

I'm not sure what you're asking. Do you mean when you declare/instantiate an array like this?

int[][] arr;

arr = {{1, 2, 3},{4, 5, 6}};

I think that's right.

***********************************

THIS IS INCORRECT

because you can assign constant values to array only at time of initialization.

Therefore above code will throw an error.

Correct way is:

int[][] arr = {{1, 2, 3},{4, 5, 6}};

thanx ..

itsabhinav123@gmail.com