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

Can you assigned value of int to a ordinary pointer?

Yes, with type-cast (but I don't see why you should):

char *ptr = (char *)300;

If you have two public classes in a java file what will be the error and how will you remove it?

Hmm, let me see, it is technically perfectly legal to have 2 classes in a single file, as long as one class is an inner class of the other: i.e. public class Stevo{ public class Fun{}}. But if you want two separate classes independent of each other the compiler would scream at you about class is public and should be declare in a file named [className].java. To fix this simply follow the compiler's instructions (shocking! the compiler actually was clear about something) and create a new file with the given name. But sometimes an inner class would be helpful, i.e. an iterator for the Abstract Data Type you are implementing.

How can you convert words to numbers?

Previous answer No is a cop-out in my opinion.
Provided words are of strict format e.g. All numbers are separated by a space, and only ZERO to NINE in words is supported, a sentence can be split into an array then the following performed for each digit.
CASE : ZERO THEN 0
CASE : ONE THEN 1
CASE : TWO THEN 2
CASE : THREE THEN 3
CASE : FOUR THEN 4
CASE : FIVE THEN 5
CASE : SIX THEN 6
CASE : SEVEN THEN 7
CASE: EIGHT THEN 8
CASE : NINE THEN 9
A new string is built from the array digits of digits
E.q. "FIVE FIVE" becomes "55"
Of course the algorithm could be expanded to cope with "TEN", "TWENTY" and so on but I wish the coder luck.

As I have added such a good answer it is only right I should be permitted a link to my excellent music website at http://www.ejay-international.com

What are the keywords in Java?

Here's a list of keywords in the Java programming language. You cannot use any of the following as identifiers in your programs. The keywords const and goto are reserved, even though they are not currently used. true, false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.

abstract

assert***

boolean

break

byte

case

catch

char

class

const*

continue

default

do

double

else

enum****

extends

final

finally

float

for

goto*

if

implements

import

instanceof

int

interface

long

native

new

package

private

protected

public

return

short

static

strictfp**

super

switch

synchronized

this

throw

throws

transient

try

void

volatile

while

* not used

** added in 1.2

*** added in 1.4

**** added in 5.0

Algorithm to arrange three numbers in ascending order using else if ladder?

step 1:start

step 2:input the values of a,b,c

step 3:if(a>b&&a>c) max=a

step 4:else if(b>c) max=b

step 5:else max=c

step 6:output:max

step 7:stop

What is an actionlistener?

An ActionListener is exactly what it sounds like. It's an interface used by other classes to listen for an action event. The simplest example of this is on a Button. Normally when you add a Button to a Component nothing will happen when you press it. You need to use a button.addActionListener(actionListener) call to make it listen for button clicks.

How do you get out of my eld class?

Study really hard and learn difficult words

How do you clear a StringBuffer?

Set length of buffer to zero to clear a StringBufferinstance.

Example:

StringBuffer buf = new StringBuffer();

// ... use buffer

buf.setLength(0);

// buffer now has zero length

What is GUI in java?

GUI stands for Graphical User Interface

This refers to the front end screens using which we access a system. For example if you logon to your online banking account, that website can be referred to as the GUI. It is the interface using which you are accessing the bank website.

What are objects and how are they created from a class in Java?

Literally, an object in programming is a collection of data and functions (remember that functions just bits of data, too). An object's class defines what those data and functions are and how to make new objects of that class.

So a class is like a cast to make a plastic toy and an object is like a single plastic toy itself.

Why do you have to use the return type for the main function in c language i mean to what does the main function have to return the value to?

It returns the value to the operating system or whatever process launched it. If you launched your program from a batch file then the batch file can detect this return value. If your program is spawned or launched by another program then the return value goes to that parent prgoram or process.

One more thing is that you can write main() without the return type and it will be absolutely correct

What is J2Se runtime?

The J2SE Runtime Environment is a platform that enables quick development and execution of Java applications. It was developed by Sun Microsystems.

What is double precision value?

That usually refers to a floating-point number that is stored in 8 bytes, and has (in decimal) about 15 significant digits. In contrast, single-precision is stored in 4 bytes, and has only 6-7 significant digits.

What is polymorphism in programming?

Polymorphism is the method in which a java program can have more than one function(or method) with the same name but different method signatures(different parameters or return type).

possible allowance:

void s()

void s(int a)

void s(int a,int b)

void s(float a)

int s()

Where union keyword used?

The UNION keyword is commonly used, as part of a SELECT statement in the SQL language, to combine two tables, which must have identical or at least compatible structures, vertically. That is, records from BOTH tables are placed into a single result table. If, for example, each table has 1000 records, the resulting table would have 2000 records - assuming there are no duplicates.

Sample code of loops and repetitions?

system.out.println(" print 1-100 numbers");

for(i=0;i<=100;i++)

system.out.println(i);

o/p1

2

3

4

5

.......