Unanswered | Answered

Java Programming

Parent Category: Computer 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.
Toll Free :0800-098-8906. For BT Yahoo - United Kingdom. Is this  the right phone number?
// set up reader   BufferedReader reader = new BufferedReader(new InputStreamReader(   System.in));   // number of line to read   int numberOfLines = 3;   // initialize the counter for number of characters   int numberOfChars = 0;   // prompt user to enter the lines of text  ...
 To test whether Java is installed and enabled in Firefox, visit one  of these Java test pages:    Verify Java Version   Verify Java Version  (alternate)    When you visit these pages, you will normally need to activate  Java. The article How to allow  Java on trusted sites...
Simply because, GUIs can be of any level of complexity. Elements  such as buttons, links, etc all need to properly reference to  different objects. If you click here, go there, if you click down  there, go here, etc. It is like a very big, complex web. You can  imagine that procedural code would...
Data is stored as objects and can be interpreted only using the  methods specified by its class.
can u please elaborate the question for details on database visit  "tutorialsera"
I actually have the author of this book as one of my Computer Science Professors at Armstrong. The book is really well layed out and easy to understand, even for beginners! The book is:Introduction to Java Programming *Eigth Edition By: Y. Daniel LiangHere is his website, it has a list of all the...
Here is a website with all kinds of java programming books:   http://www.freeprogrammingbook.com/java.php
Multithreading:    Multithreading is a process of executing multiple threads  simultaneously.  The concept of threads provides a mechanism to make maximum  utilization of CPU.Basically a thread is a light weight  process.  Both multithreading and multiprocessing are used to achieve ...
Java has three types of comments that I know of...    Single line comments beginning with a double forward oblique  stroke:    // This is a single line comment   // here's another    There's also multi-line comments:    /* This comment could   ** traverse   ** many...
I bought a 1 ton split A\\C this week. It's power consumption is  1000 W. The outer temperature in our area in day time is 34-36  degree Celsius. I set up the ac for a 27 degree which is  comfortable for me. So i want to know, how to reduce then power  consumtion of this ac. My room is much...
import java.io.*; class StateCap { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String s[]={"Uttar Pradesh","Maharshtra","West Bengal","Bihar","Jharkhand","Kerala","Tamil Nadu","Madhya Pradesh","Sikkim","Rajasthan"}; ...
Runnable in java , is an interface which helps in creating threads.   E.g. you want to create thread Demo , then you will do like this    class Demo implement Runnable   {   // your code   }    Now to start thread in a program you have to do like this   /* create your thread...
There are many way to define a term, one of which is:    When a class inherits properties and behaviours of two more classes  it is said to be multiple inheritance.
When all references to an object is Java are gone, the garbage collector will come along and free up the memory used by that object. Every Java object has a method named finalize, which is called by the garbage collector when the memory for that object is being deallocated. "Finalization" is just a...
 The java.lang.System class contains several useful class  fields and methods. It cannot be instantiated.Facilities provided  by System:     standard output     error output streams     standard input and access to externally defined properties and  environment variables. ...
final keyword when used with a variable makes it a constant which  means we cannot change it's value further:    eg:    final int MY_CONST = 30; // creating a constant with final keyword   MY_CONST = 40;//this line will generate an error as MY_CONST is a  constant   ---------------...
Two-dimensional arrays are typically iterated through using nested for loops. If you had a 2-D array alpha with ints ROWS and COLS representing the number of rows and columns respectively, and ints row and col as iterators, the loop would look like this: for (row = 0; row < ROWS; row++){ for ...
import java.io.*; class AvgWordSent { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the Sentence: "); String s=in.readLine(); byte a=0,b=0; float c=0; for(byte i=0;i<s.length();i++) { if...
There is no difference. They mean exactly the same thing. Portable code is independent of the platform while non-portable code is platform-dependant.
To overcome the problems faced because of the use of structured programming, the object oriented programming concept was created. The OOP makes use of bottom-up approach and manages the increasing complexity. Description of an OOP can be given as , a data that controls access to code.
You can use Java Wrapper class to do this. You can use Integer  Wrapper to create integer object and then use toString() to convert  to String.
There is not strict rule. It is only a convention. Most Java  programmers use camel case for methods and variables. All uppercase  are usually reserved for constants.
an object of the type you want is instantiated (created) by calling  its constructor such as shown below:   the "new" keyword is needed as it tells the compiler to create a  new object of type MyClass.    <code>   //creates an instance of a MyClass() Object   MyClass() <...
because java is categorized into packages and packages contain classes which are not accessible directly.
All Java methods belong to a class. This is just the way the language is designed. Besides, if any method were to be written outside of a class, you would have no way to reference it.
J2ME: java to micro edition for applications which run on resource constrained devices like cell phones.J2SE: java to standard edition and is normally for developing desktop applications.
boolean - 1 bit (1/8 bytes) - The actual storage requires for a boolean type is not defined for Java implementations. byte - 1 byteshort - 2 bytesint/char - 4 byteslong - 8 bytesfloat - 4 bytesdouble - 8 bytes
int main() { int x, y; char op; int res; printf("Enter two numbers and a operator\\n"); scanf("%d %d %c", &x, &y, &op); switch (op) { case '+': res = x+y; break; case '-': res = x-y; break; case '*': res = x*y; break; case '/': res = x/y; break; default: printf(...
Imagine you want to save the state of one or more objects. If Java didn't have serialization, you'd have to use one of the I/O classes to write out the state of the instance variables of all the objects you want to save. The worst part would be trying to reconstruct new objects that were virtually...
It is not. Visit java.sun.com and dowload the suitable JRE (or JDK) version for your platform. Note: The java bytecode executed by JVM is indeed platfom-independent.
No it can execute almost any byte code it is given not just Java
No you have to install it and it is platform dependent.
Casting an object to a child object is to make accessible fields,  methods, etc that are found only in a child. For example.   ObjectA has field apples, and   ObjectB (which extends ObjectA) has field bananas, and   ObjectC (which also extends ObjectA) has field strawberries.    We...
You cannot. Abstract classes cannot be instantiated and hence cannot be invoked from the main method or any other class directly.
Java does not support operator Overloading.
A static class may or may not have static members. Adding the static keyword to the class definition won't change this. Note that an inner class which is not static may not contain static members (unless those members are also declared final).
A constant is a term used in java whose values doesn't change during the execution of the program, while, a variable's value can be changed during the execution.
"real" numbers, in any programming language, are actually approximations of what is called a "real number" in math. Basically, a number that can handle decimals - but unlike the actual real numbers, of limited precision. In Java, the "real" data types are float, and double. double has greater...
public class PrintValues { public static void main(String[] args) { for (int i = 1; i
It's easy to learn and works in browsers. Also, it was used to make Minecraft.
A BufferReader can read certain things like BufferedImage which with the right code can allow for animation to be done using a G.U.I (Graphical User Interface) if you want to see how its used i would recommend watching TheChernoProjects 3D game programming tutorials on youtube.
Java doesn't support multiple inheritance.
parseInt() is a method in the Integer class in Java that is used for parsing string values as numbers. int i = Integer.parseInt("10"); would result in i being assigned a value of 10
jdk 1.4 not hve for each regulear expression exception changing
  WebRep   Overall rating     
public int max(int x, int y, int z){return Math.max(x,Math.max(y,z));} . The method Math.max() only accepts 2 arguments, soyou need to perform this method twice if you want to compare 3numbers, as per the code above.
import java.io.*; class TwoD { protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the no. of Elements: "); byte a=Byte.parseByte(in.readLine()); int ar[]=new int[a]; long sum=0; for(byte i=0;i<...
/* INPUT: Holy Home * OUTPUT:H * ------------ o * --------------l * ---------------y * ---------------- _______________//The '-' are spaces * ------------------H * --------------------o * ---------------------m * -----------------------e * */ import java.io.*; class StyleString { ...
import java.io.*; class RevWords { private byte wo(String s) { byte a=0; for(byte i=0;i<s.length();i++) { if(s.charAt(i)==' ') a++; } a++; return a; } protected static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); RevWords...
The code is given at the bottom. This code requires JAVA 1.5+ version to be compiled. This is very simple program. We ask user to input string and later we just iterate through all the character in the string. We use Character.isUpperCase() static method to check is the character we are checking is...
it is java people community to discuss about the new development and new development those are done with java language it is presented
There are hundreds of pre-written libraries in java, which you canuse in your programs to make it easy to read and small. Matter offact you don't have to write big codes just import this library anduse their methods or class whatever you need. for example, you want use LinkedList in java. So instead...
1. It's easy to write unreadable code with it. 2. Some people's religion doesn't allow it. 3. There are languages that do not have goto.
Private variables (and methods) in Java are those members of a class which can only be accessed by that class and other methods of that class.
  Let's take this in two parts. First, why is Java appropriate for web-based applications. There are Java plugins for most major web browsers, and Sun's Java comes with those plugins built into the install package. In this respect, it is easy to get your application online. Second, why is Java...
A semicolon ";" will end a Java statement
The size of an empty class is not normally 1 byte, actually. It will usually be equal to the word size defined by the platform it is running on (often 2 or 4 bytes). This is because the word size is usually used as a memory address size and an empty class still needs to point to some location in...
int i;for (i=10; i<=50; i+=2) loop statement;
OOP(Object-Oriented Programming) provides a clear modular structure for programs which makes it good for defining abstract datatypes where implementation details are hidden and the unit has a clearly defined interface.
Better usage of resource available. . Task parallelism. SP.
Synchronization is the capability od controlling the access of multiple threads to any shared resource. It is used : 1) to prevent thread interface. 2)to prevent consistency problem
Let's say you want a method which will determine if the given character is a vowel, consonant, or other (non-letter). // Will return a String representation of what the given character is: // "vowel" "consonant" or "other" public static final String getTypeOfChar(final char c) {   // since...
for example: javac First.java Second.java
  you mean JavaApplet or Ajax? I do not think you can compare java as a whole and AJAX. Ajax is a simple implementation of JAvascript .
  a variable holds a single type of literal. i.e. 1, bat, 345. A object is a instance of a class created by the a programmer with a set of methods which preforms certain task depending what methods have been defined. int a = 4; // a would be the variable Car b = new Car();// b is an object b...
In Java applications, use the Scanner class. For instance: import java.util.scanner;... Scanner input = new Scanner(System.in); System.out.println("Type a word: "); String word = input.nextLine();Oh, and by the way, the Scanner class didn't exist until jdk 1.5.
Nothing unless the "java" your talking about is coffee. The sorta answer is that java is a programming language while java 1.5 is the 5th release of the languagethere are i believe 7 public versions. (maybe 6 but I'm not sure.)Java 1.1, 1.2, 1.3, 1.4, 1.5, 6, & 7. (6 & 7 aren't java 1.6 and...
to read and write occurence of a particular character
No. While there are quite a few which use arrays to store their data (ArrayList, HashMap, Vector, etc.) the typical counter example is a LinkedList. Java's implementation of the LinkedList class uses the standard Entry-Entry.next method of connecting elements in the list.     You can even...
import java.util.List;import java.util.ArrayList;import java.util.Collections;class Vertex implements Comparable<Vertex>{ public final String name; public Edge[] adjacencies; public double minDistance = Double.POSITIVE_INFINITY; public Vertex previous; public Vertex(String argName) { name =...
First, you must have an idea what your program is supposed to do. For example, you might design the forms the user sees on paper; if calculations are to be made, you must have a general idea of the steps required. Then you try to translate that into the computer language of your choice.\n First,...
•Descending chromatography is faster because gravity helps the solvent flow.
In order to access a base class member the base class member must be declared protected or public. Private data is only accessible to members of the same class and to friends of the class. I'm not entirely sure what you mean by accessing from a database. A derived class does not require a database...
Multilevel inheritance is when there is a multiple father child hierarchy in your application. Ex: class A extends class B class B extends class C class C extends class D This means class A extends class D indirectly through classes B and C.
insecta have two body parts while arachnida have three body parts.
Compiling a java program is an action where the Java Compiler scans through a java program checking it for syntactical correctness and generates the byte-code (the system recognizable form) of the class so that the program can be executed. Javac is the command that compiles a java class.
When you implement an interface, you're agreeing to adhere to the contract defined in the interface. That means you're agreeing to provide legal implementations for every method defined in the interface, and that anyone who knows what the interface methods look like can rest assured that they can...
The simple answer is that compile-time polymorphism occurs at compile time while runtime polymorphism occurs at runtime.The actual answer is that compile-time polymorphism results in the compiler generating source code on your behalf while runtime polymorphism relies on function pointers or virtual...
class reverse { public static void main(String args[]) { int a=0; int b=Integer.parseInt(args[0]); while(b!=0) { int n=b%10; a++; System.out.println(n); b=b/10; } System.out.println("\n digits are..." + a); } } by this prog u can reverse the nos. as well as it...
1.take while loop in which u continue up to null in array of string. 2.once u get null pointer then take a new array of same length. 3.when u get null there ll save position no in variable i. 4.take while loop i to 0; 5.and j=0 for new array. 6.in above loop copy old array to new array in each...
it means the basic summary of the topic given in detail.
Hey sunil i have an idea about mode that is more repeated data is mode ok na Example in the series 2,4,5,2,4,5,2,4,24,22,2,2,7,8,9,2 Mode for this data is 2 i.e. Answer is 2
method overriding :method overriding means redefine methods in sub classes they already defined in the Super classes.method overloading : It means methods with the same name but with a different signature exist in one class
In Java (or in any OOPL) static means, the member we are defining as static will act as a global member for all the objects. That means, suppose there is a "static int i" in a class ABC. The data i will be common to all of its objects. In the case of a Class attribute (variable), static indicates...
- Abstraction in OOP is intended to facilitate re usability of the code- To facilitate polymorphism- Abstraction lets you focus on what the object does instead of how it does it.- Abstraction helps in defining a contract between the consumer and provider. The consumer wont get affected even if the...
Java began in 1991 by a company called Sun. A small team of engineers labelled the "Green Team" (lead by James Gosling) started the project with the aim of creating a programming language for the digital cable television industry, but it was too advanced at the time. However, the Internet was just...
My answer really depends on your skill level in programming. For a newer programmer, i would say that a static variable is a variable that works for everything. You put it first in your code and it is capable of running through all parts of your program. For a more advanced programmer, a proper...
JVM makes Java Platform Independent..It loads byte code(.class file) and Run it.