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

Difference in hibernate 2.0 and hibernate 3.0?

Enhanced Hibernate Query Language

Enhanced Hibernate Criteria Query API

Enhanced support for queries expressed in the native SQL dialect of the database

Is screenr safe?

i Would say it because when i used to use it it would run slow and i got a warning from java

What is the difference between implicit and explicit Java programming?

Explicit means done by the programmer.

Implicit means done by the JVM or the tool , not the Programmer.

For Example:

Java will provide us default constructor implicitly.Even if the programmer didn't write code for constructor, he can call default constructor.

Explicit is opposite to this , ie. programmer has to write .

Program to make frequency count of words in a given text?

class Count

{

public static void main(String args[])

{

int i,c=0;

int n=args.length;

System.out.println("length is"+n);

for(i=0;i<args.length;i++)

{

System.out.println(args[i]);

c++;

}

System.out.println("number of words="+c);

}

}

What do you mean by public private protected and friendly?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are:

1. Public

2. Protected

3. Default and

4. Private

Java does not have a friendly access modifier.

Public Members:

If a variable or method is declared public, it means that it can be accessed by anyone or any other class (irrespective of which package they are in).

Private Members:

Members marked private can't be accessed by code in any class other than the class in which the private member was declared

Protected and Default Members:

The protected and default access control levels are almost identical, but with one critical difference. A default member may be accessed only if the class accessing the member belongs to the same package, whereas a protected member can be accessed (through inheritance) by a subclass even if the subclass is in a different package

Describe two examples of Java-based applications that might use methods that have two or more parameters?

One practical example would be an application that would need to compute interest earned on a savings account or multiple savings accounts at the end of the year. Another would be an application that tracks a person's name and age and then sorts them into similar or randomized groups.

Write a program that give all the rotations of a string?

#include<stdio.h>

#include<string.h>

int main()

{

char a[80];

int rotated_element_number[80];

int rotation;

int i;

int length;

printf("enter the word: \n");

gets(a);

length = strlen(a);

printf("the reversed string is:\n");

for( rotation=0; rotation<length; rotation++)

{

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

{

rotated_element_number[i] = i + rotation;

while(rotated_element_number[i] > (length-1)) rotated_element_number[i] -= length;

printf("%c", a[rotated_element_number[i]]);

}

printf("\t");

}

getchar();

return 0;

}

How many threads run at the start of JVM?

at the starting of the JVM it handels approx 7000 threads .........

Can you instantiate an abstract class?

No. You must create a subclass of the abstract class in order to be able to instantiate it.

Types of purchase method?

What is the type of purchase method? And I want to know about what different between purchase method and pooling method?

installment plans: People began to buy expensive goods using installment plan credit during the 1920s.

What is mean by class access?

Class access is the ability for any given class to access the functions of another class. Private access limits access to data and code just to the class that contains the private access modifier. The so-called "default" access grants private access, as well as access to any class in the same package. Protected access grants the same as "default" access, and also allows subclasses to access the code and data. Public access allows any class in any package to access the code and data.

What is static key word?

It is one of the constant key word and it is used only in run time

How do you implement multiple inheritance through interface in java?

The multiple inheritance is supported by using more implements key word

example

class a implements b, implements c, implements d

{

....

}

so here the class a supports multiple inheritance by implementing class b,c,d.

Java does not support true multiple inheritance - true M.I. requires that a class be able to inherit directly from multiple classes. That is, in M.I., Class A can be a direct child of Class B and C.

To get much of the functionality and advantages of the M.I. model, Java uses Interfaces. Thus, a Java Class A will be the child of Class B, but can implement several interfaces X, Y, and Z. This attempts to mimic the behavior that in a M.I. language would be given by Class A being a direct child of B, X, Y, and Z.

The major difference between a M.I. language and a single-inheritance language with interfaces (like Java), is that interfaces can only define the method signatures and constants; they CANNOT provide implementations of those methods in the interface specification. Thus, any class which implements a given interface must provide an actual implementation of the methods that the interface describes. The big downside to this is that it can lead to a large amount of "code copying" - that is, if both Class A and Class B implement an interface X, there is a good chance that most of the methods from X will have the same code implementation in both Class A and B. Sometimes this is unavoidable; however, it is also considered good programming style to use abstract Classes to implement commonly used interfaces, then put that abstract class fairly high in the object hierarchy, allowing large numbers of classes to inherit from that abstract Class (which, in turn, means they have access to the implementation of those interfaces without having to copy the code). The advantage of interfaces is that they can keep things conceptually clean, and also make it simple for classes to decide how they want to implement the method contract the interface describes.

Practically speaking, if you would like Class A to inherit from Class B and also to inherit from Class C, then, in Java, you would simulate this via interfaces this way:

public class B {

// the superclass

methods_go_here_with_their_implementations;

}

public interface C {

// the Java equivalent of Class C in a M.I. Language

the_method_signatures_of_C_go_here;

}

public class A extends B implements C {

implementations_of_methods_in_C_go_here;

}

What is a logic error in a programs code?

It is a generic term for screwing the program code up. It means that somewhere in the coding it is not doing what it is supposed to do. Say you wanted to add the amount of apples and then print the amount for inventory. The code says that it is adding the apples then sending a zero amount for the amount to the inventory.So the inventory shows a zero balance all the time. This is a logic error. Good luck.

Sample Sql query with explanation for selecting the alternate row from the table?

SELECT *

FROM ( SELECT FirstName LastName

FROM people

) @tempTable1

WHERE MOD(@temptable1.rn 2) 1

--even number query

SELECT *

FROM ( SELECT rownum rn firstname lastname

FROM people

) @temptable1

WHERE MOD(@temptable1.rn 3) 0

but it is not working properly...can anubody tell me what is rownum here...