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

Length of data types?

* byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation. * short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters. * int: The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive). For integral values, this data type is generally the default choice unless there is a reason (like the above) to choose something else. This data type will most likely be large enough for the numbers your program will use, but if you need a wider range of values, use long instead. * long: The long data type is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive). Use this data type when you need a range of values wider than those provided by int. * float: The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. As with the recommendations for byte and short, use a float (instead of double) if you need to save memory in large arrays of floating point numbers. This data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead. Numbers and Strings covers BigDecimal and other useful classes provided by the Java platform. * double: The double data type is a double-precision 64-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. For decimal values, this data type is generally the default choice. As mentioned above, this data type should never be used for precise values, such as currency. * boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined. * char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

What function of java server pages?

Java Server Pages have become an integral part of any J2EE application. They are used extensively because they can combine the features of HTML and Java. The difficulty level of JSP is half-way between HTML and pure Java. For simple tasks like displaying the current date, you write a normal HTML page and add only a small amount of Java as a scriptlet. For big tasks like processing a shopping cart, you use JSP as the mediator between the Web form and a component (Ex: Servlet) that has all the processing logic.

CGI, Perl, Active Server Pages etc were all the predecessors of Java Server Pages. Am not saying that the JSP Technology was built based on these technologies but it is safe to say that, the JSP Technology was created to overcome many of the shortcomings in the above mentioned technologies. Though the ASP technology is a web server scripting champion and is used very widely, the only problem is the Runs only in Windows Attitude of the technology. Unlike ASP, JSP has equivalent if not better features and can run in any environment making it an invaluable tool for enterprise application developers who don't want to be tied to the limitation of the system running only in Windows.

Not only does JSP run on all major platforms, but the JavaBeans used by these JSPs run on all major platforms as well.

JSP competes directly with ASP. In fact, you would be forgiven if you thought it was a copy. Sun took the same approach to JSP as it did with Java. Sun borrowed the syntax of its best competitor (ASP for JSP and C++ for Java) tweaked it a little, but built everything under the hood from scratch. Java syntax comes from C++, but it works on all platforms with no portability issues like C++ for the developer. Similarly, the JSP structure comes from ASP. The look and feel, and even some syntax is the same. However, ASP primarily uses Microsoft's versatile VBScript, while JSP uses the more powerful and portable Java and JavaScript.

Why do you think Java programming has been slower to catch on outside the US?

Less access to technology and I'm assuming less knowledge of it as well

Write a program to change the case of the given string?

This functionality is already in Java. String.toLowerCase() and String.toUpperCase() will take care of it for you.

How do you write a menu-driven Program in java to check a perfect and palindrane number?

import java.io.*;
class PerfectPalindrome
{
private boolean per(int a)
{
int b=0,c=1;
for(;c<=(a/2);c++)
{
if(a%c==0)
{
b+=c;
}
}
if(a==b)
return true;
else
return false;
}
private boolean pal(int a)
{
int b=a,c=0;
for(;b>0;b/=10)
{
int d=b%10;
c=(c*10)+d;
}
if(c==a)
return true;
else
return false;
}
public static void main()throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("1. Find a number is a perfect one or not !");
System.out.println("2. Find a number is a palindrome or not !");
System.out.print("\nEnter your Choice: ");
int a=Integer.parseInt(in.readLine()),c;
System.out.print("Enter the Number: ");
c=Integer.parseInt(in.readLine());
boolean b;
PerfectPalindrome e=new PerfectPalindrome();
switch(a)
{
case 1: b=e.per(c);
if(b==true)
System.out.print("It is a Perfect Number !");
else
System.out.print("It is not a Perfect Number !");
break;
case 2: b=e.pal(c);
if(b==true)
System.out.print("It is a Palindrome Number !");
else
System.out.print("It is not a Palindrome Number !");
break;
default: System.out.print("SORRY!! Wrong Choice!");

How are default parameters useful?

C itself does not support default values for function arguments, if that is your definition of parameter.

In languages that do, like C++/python/ and Java (presumably) you can use default parameters as a rudimentary form of polymorphism in the sense that you can call the function or method with a minimal set of arguments assuming the that others are defaulted to the values you want, this can be actual defaulted values like the number -1, or sentinel values that omit functionality in the function/method you are calling.

You will, in most of these languages that support this, have to arrange the position of the defaulted arguments to the end of the argument list, and in doing so it would be best to prioritize them from least likely to use the default value to the most from left to right. This in design time can conflict with function/method overloading where you vary the number of arguments in the prototypes of your overloaded function, so I consider these two features of a language mutually exclusive, i.e. don't use them together unless you have a good reason.

This feature is rarely useful but in saying "rarely" when it is, it is the most helpful. I find it and so do the creators of the C++ libraries helpful for class constructors when sometimes you need to set some internal features during construction time.

Why can't you open the java development tool?

The Java Development Kit (JDK) is a command-line based application. That means it is run through the command prompt. The usage of this is similar with all platforms, however for each operating system it is different.

For Windows, go to Start -> Programs (All programs on XP) -> Accessories -> Command Prompt. It will show a black screen in which you type commands in.

For Macs, go to Applications -> Utilities -> Terminal

In the prompt, type 'java' or 'javac'. As the compiler is 'javac', you may need to add an enviornmental variable to point to the location of Java (javafolder/bin/javac.exe)

What is mean by functions in oops?

Functions are used to carryon a specific task or to perform specific operation.

Where are the random numbers placed in slot machines?

While older slot machines used a mechanical/mathematical approach (the number of icons on each wheel, combined with the required combination of those to yield various winning matches), today's typical slot machine are completely computerized. They generate thousands of random combinations per second, and when you pull the handle (or push the button), the cycle stops and you get the number it was up to. The handle, the slowing-down of the wheels, etc., are there simply for historical purposes.

What is a single core ghz?

"Single core" refers to the computer's main chip having a single processor. Newer models, such as Intel's i3, i5 and i7, have multiple processors (2, 4, or 6 processors), usually called multiple "cores", on a single chip.

GHz refers to the clock speed of each individual processor. It gives you a rough idea of how fast it can process data. However, the processing speed will also depend on other factors.

How do you generate a random integer within a range in Java?

Take advantage of Java's easy-to-use Random class.

// Create a new Random object.

// The constructor accepts a single Long argument.

// This is the seed for the random generator.

// Using the current time is standard for most applications.

Random rnd = new Random(System.currentTimeMillis());

// A call to nextInt(n) will generate a random value from 0 to n-1

// This is typical in programming languages, and in order to get a specific range we need

// to tweak it a bit.

rnd.nextInt(n);

// This will give you a random int from (start) to (start + range - 1)

rnd.nextInt(range) + start;

Why is single thread system not used in java?

Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.

Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.

Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.

Because the developers of Java considered the possibility of multithreading a big advantage. You don't HAVE TO use multiple threads; just use it when you need it.

Which qualifier is used to declare read-only variable in java?

A variable declared as final can't be modified, once a value is assigned.

What is the difference between default constructor and parameterized constructor?

A default constructor is one that has no parameters (C++ also calls constructors with all default parameters a default constructor), while a parameterized constructor is one that has at least one parameter without a default value. Default constructors can be provided by the compiler if no other constructors are defined for that class or any class the class inherits from, while parameterized constructors must always be defined by the developer.

What is meant by private visibilty of a method?

It means that the method is visible from only within the current method. Also, any class that wants to use or invoke the private method has to create an object of the class in which the method is created in order to access/invoke it. The private access modifier is the most restrictive of the four java access modifiers. The total opposite of private is public which gives access to everyone.

What are the characteristic of good test cases?

  1. It should be simple and clear, any tester should be able to understand it reading once.
  2. Should be accurate and tests what it is intended to test.
  3. No unnecessary steps should be included.
  4. It should be reusable.
  5. It should be traceable to requirements.
  6. It should be independent. i.e. You should be able to execute it in any order without any dependency on other test cases.

What does import java.util.Scanner?

It is used import your scanner class. In other words bringing in the scanner class.

How do you disable a button in Java?

you can easily disable java in almost all of the web browsers! I just came across this article telling how to disable java in different browser, check this out :

http://studyabroadfree.com/how-to-disable-java-in-browsers-after-us-cert-warning/

How are the strings passed to a function?

By reference. The name of the string is converted to a pointer (in C/C++) and given to the function as the address of the first element. (In Java, all objects are passed by reference, and there are no pointers.)

What are the advantages of interface IN JAVA?

  • Interfaces are classes that help us in implementing partial Multiple Inheritance in Java.
  • It helps us in defining skeleton behavior for our classes.
  • Also, it is used for creating classes that store application level constants

What is Java byte-code level language?

Java byte-code is the code which generate after the compilation of .java file.And this code is only understand by JVM(java virtual machine ) which understand it and execute it.In other languages this type of functionality is not available.

Does Linux have java support?

Yes. Most operating systems have some form of Java for them.

What is shine enterprise java pattern?

Shine Enterprise Java PatternShine Enterprise Java Pattern has been developed for variety of application. This pattern has these parts:

Maplet: a framework for doing web projects which are coincidence with MVC architecture. This framework helps developers to follow a standard pattern for developing a web application. Maplet helps developers to save time of developing and extending.

JShooter: a framework that makes reflects oriented programming an easy job for developers. Meanwhile it helps distributing application on the network.

JConnection: This package helps developers to work with JDBC and Hibernate easier than before.

Util: This package helps developers in these subjects:

1- File System

2- Runtime

3- Compiler

4- System Information

5- Web Socket

6- MD5

7- Thread

8- Validation

9- XML Parsing

10- Web uploading

Maplet (Web, MVC Framework)

What is Maplet?

Maplet is a framework for implementing web based program, which is compatible with MVC architecture. This framework is very easy and helpful for developers and analyzers to do their jobs better than before.

JShooter (Reflect in Network Framework)

What is JShooter?

JShooter is a framework for distributing application programs on the network. Certainly, you have used RMI, Corba and JMS. Each of aforementioned technologies has its own special problems and at the same time enjoys extraordinary advantages. However, you must be careful about the expenses caused by these technologies. In most cases RMI, Corba and JMS increase the productions' costs unbelievably. However in other cases they confuse programmers. Years ago, Reflect Oriented Programming was the focus of attention within professional programmers, then Aspect Oriented Programming came into the programming world but instead of reducing the programmer's task, it causes the professional programmers and even the amateur ones to be confused in many cases. One of the most important capabilities of JShooter is that it makes the "Reflect Oriented Programming" easier to use.

JConnection (JDBC & Hibernate Component)

What is JConnection?

JConnection is a tool for developers at the DB layer that solve lots of amateurs' problems. This tool helps you to work with JDBC and Hibernate.

JDBC Class

This class helps you to less engagement with Statement and Connectionin entities in JDBC.

Hiberbate Class

This class makes it easy to work with Hibernate

What is Util?

Util package helps you to implement your application very easily. This package helps developers who don't want to use basic codes for their application.

What is Analyzer Class?

This class helps you to do XMLParsing easily.

What is Browser Class?

This class allows you to access the contents of a site via Web Socket.

What is Code class?

This class can considerably help you in encryption.

"addFileToWindowsRuntime", create a new class. Afterward you can create an object from the created class by using JShooter.

What is Info Class?

This class gives the user specifications from the executive system.

What is JCompiler?

This class considerably helps you to compile at the run time. For using it, you should inherit from the JCompiler class, then use the "addFileToWindowsRuntime", create a new class. Afterward you can create an object from the created class by using JShooter.

What is JThread class?

This class remarkably helps using Threads. The class that uses JThread class, must fist inherit from JThread.

What is JValidation Class?

This class helps in validations.

What is root class?

This class is designed for working with FileSystem.

What is run Class?

This class helps you using operation system commands in your application without considering the type of it.

What is normative method?

This is concerned with looking into the commonality of some elements. Best used with status study.