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 do you get rid of Java-ByteVerify?

== == == == == == This is not a virus, but rather a method to exploit a security vulnerability in the Microsoft Virtual Machine. First, update to the latest version of Java Runtime Environment (JRE) - 6 Update 3 (as of June 2008. # Click on Start> Control Panel and double click on Add/Remove Programs. Locate Java 2 Runtime Environment, SE v1.4.2and click on Change/Remove to uninstall it. # visit the SUN Java's website. http://java.sun.com/javase/downloads/index.jsp

# Scroll down to Java Runtime Environment (JRE) 6 Update 3. Click on Download. # Select Accept License Agreement. The page will refresh. # Click on Windows Offline Installation, Multi-language and save it to a convenient location. # Run this installation to update your Java. 2) Run a windows update

3) Do a complete scan with a fully updated Anti virus Program.

Can you use objects in class level declaration?

Objects are classes... It's the most abstract type of data.

Garbage collection in net and j2ee?

How Does the Garbage Collector Work?

You just can't be sure. You might hear that the garbage collector uses a mark and sweep algorithm, and for any given Java implementation that might be true, but the Java specification doesn't guarantee any particular implementation. You might hear that the garbage collector uses reference counting; once again maybe yes maybe no. The important concept to understand for the exam is when does an object become eligible for garbage collection? To answer this question fully, we have to jump ahead a little bit and talk about threads. (Don't worry, We will take a detailed look at Threads in future.) In a nutshell, every Java program has from one to many threads. Each thread has its own little execution stack. Normally, the programmer causes at least one thread to run in a Java program, the one with the main() method at the bottom of the stack. However, there are many really cool reasons to launch additional threads from your initial thread. In addition to having its own little execution stack, each thread has its own lifecycle. For now, all we need to know is that threads can be alive or dead. With this background information, we can now say with stunning clarity and resolve that an object is eligible for garbage collection when no live thread can access it.

Based on that definition, the garbage collector does some magical, unknown operations, and when it discovers an object that can't be reached by any live thread, it will consider that object as eligible for deletion, and it might even delete it at some point. When we talk about reaching an object, we're really talking about having a reachable reference variable that refers to the object in question. If our Java program has a reference variable that refers to an object, and that reference variable is available to a live thread, then that object is considered reachable. We'll talk more about how objects can become unreachable in the following section.

Can a Java application run out of memory? Yes. The garbage collection system attempts to remove objects from memory when they are not used. However, if you maintain too many live objects (objects referenced from other live objects), the system can run out of memory. Garbage collection cannot ensure that there is enough memory, only that the memory that is available will be managed as efficiently as possible.

What is the difference between first class and business class on united airlines?

first class first class bigshots will go..Business class business freak junk heads will go..hehehehheheh

Is string is a primitive type or not?

,

Strings are not a primitive data type and strings are objects of class String.

They have been built this way primarily because a large number of methods can be implemented for use if string is a class. That way coding regarding strings is much easier.

If you really want to implement it as a primitive data type, go ahead and create an array of characters. but then you wont be able to utilize all the string related methods in JDK

Regards,

Prime

Three kinds of relationships in object oriented modeling?

  • 'is_a' classification relations
  • 'part_of' assembly relationships
  • 'associations' between classe

Given a sorted array- 8 13 17 26 44 56 88 97. Using binary search method find the element 88. show the contents of high low and mid at each step?

The array has eight elements indexed 0 to 7. The middle element will be found at index (0+7)/2=3. Element 3 has the value 26, which is smaller than 88, so 88 must reside in the array starting at index 4 ending at index 7.

The array has four elements indexed 4 to 7. The middle element can be found at index (4+7)/2=5. Element 5 has the value 56, which is smaller than 88, so 88 must reside in the array starting at index 6 ending at index 7.

The array has two elements indexed 6 to 7. The middle element can be found at index (6+7)/2=6. Element 6 has the value 88. Thus 88 was found at index 6.

How do you calculate the point on the edge of a circle that corresponds to a degree given the radius of the circle?

public void getPoint(double r, double angle)

{

//cosine*hypotenuse=adjasent

double x = r * Math.cos (Math.toRadians(angle))//in radians;

//sine * hypotenuse =opposite

double y=r*Math.sin(Math.toRadians(angle))//also in radians;

System.out.println("( "+x+", "+y+" )");

}

Default constructor in java?

If you don't type a constructor into your class code, a default constructor will be automatically generated by the compiler. The default constructor is ALWAYS a no-arg constructor. (Obviously the compiler has no clue what all arguments you might want for your class. So it takes the safe way out with a no argument constructor)

A no-arg constructor is not necessarily the default (i.e., compiler-supplied) constructor, although the default constructor is always a no-arg constructor. The default constructor is the one the compiler provides! While the default constructor is always a no-arg constructor, you're free to put in your own no-arg constructor.

How is interface instantiated in anonymous class for example new ActionListener?

They key word here is anonymous class. While ActionListener may be an interface, the anonymous class would be a subclass of ActionListener. It would be like creating a new class which implements ActionListener.

JButton button = new JButton("Press Me!");

button.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ev) {

System.out.println("PRESS");

}

});

What is an unclosed string literal?

The error "unclosed string literal" means that you wrote a double quote " somewhere but you didn't write another double quote later on to close the string.

Note: You cannot start writing a string on one line and continue on another line, like this:

System.out.println("Hello

World");

If you absolutely want to distribute this over multiple lines, do it like this:

System.out.println("Hello "

+ "World");

How to write Java program for find longest word in a string?

class LongestWord

{

String str = "Ram is intelligent boy";

String stringArray[] = str.split("\\s");

public String compare(String st1, String st2){

if(st1.length()>st2.length()){

return st1;

}

else{

return st2;

}

}

LongestWord(){

String word = "";

for(int i=0;i

if(i==0){

word = stringArray[0];

}

word = compare(word, stringArray[i]);

}

System.out.println("Longest word = " + word);

}

public static void main(String []args){

new LongestWord();

}

}

What is an example program in Bluej whether a number is a palindrome or not?

class test

{

public static void main(int num)

{ int num2=num;

int rnum=0;

while (num2>0)

{ int q=num2/10;

int dig=num2%10;

rnum = rnum*10+dig;

num2=q;

}

if (rnum==num)

System.out.println("Palindrome number");

else

System.out.println("Not a Palindrome number");

}

}

If else else sample programs java?

if (i==2)

if (j==2) System.out.println ("i==2 and j==2");

else System.out.println ("i==2 and j<>2");

else System.out.println ("i<>2");

What is containment in oop?

When an object in created within another object, the relationship between them is containment.

Why the index of an array be a positive number?

Since an array cannot contain a negative number of items, the size of an array must be at least 0. So if you ever tried to retrieve the element at a negative index in an array, it would automatically be understood to be out-of-bounds.