How long does it take to be a constructor?
Well it doent take that long I don't know exactly but it's not a long time.
How do you replace a vowel into asterisk using java program loops?
If you want to do it neat and effortless, you may use enums.
public class MyClass {
private enum VOWELS { A,E,I,O,U,a,e,i,o,u; }
public static void main(String []ar) {
String s = "Hello World";
for(VOWELS c : VOWELS.values())
s = s.replace(c.name(), "*");
System.out.println(s);
}
}
.
Ram
Why is java strongly associated with the internet?
import java.util.*; class Box { int d; int w; int h; int c; public void Volume() { Scanner s = new Scanner(System.in); System.out.println(" Enter depth"); d=s.nextInt(); System.out.println("Enter widhth"); w=s.nextInt(); System.out.println("Enter height"); h=s.nextInt(); c=d*w*h; System.out.print("Volume of box :"+c); } public static void main(String ar[]) { int ch; Box o = new Box(); System.out.println("1. Voulume of box"); Scanner s3 = new Scanner(System.in); System.out.print("Enter ur choice"); ch = s3.nextInt(); switch(ch) { case 1: o.volume(); break; default: System.out.print(" Invalid choice"); break; } } }
How to convert lowercase to uppercase in java?
In Java you can invoke the toUpperCase()method on a string to convert it to a new string with all upper case characters.
For example, "abc".toUpperCase() returns "ABC"
Likewise, the static Character.toUpperCase(char ch) method takes a single character and returns the upper-case equivalent of that character (e.g. 'a' -> 'A').
What is foreign keyword in java?
There is no "foreign" keyword in Java, however, there is a native keyword that declares native methods in a native language, such as C or C++.
For full list of keywords in Java see related question.
What are the purposes of inheritance in java?
Inheritance is one of the fundamental properties of java, allowing subclasses to inherit all of the public methods and data members of their respective superclasses. For instance, assume there are three classes named "Bug", "Arachnid", and "Black Widow". Arachnid extends (inherits) Bug, and BlackWidow extends Arachnid. Therefore, BlackWidow inherits all of the properties of Arachnid (eight legs, segmented body, etc) and all of the properties of Bug (small, creepy, exoskeleton, etc). Arachnid only inherits Bug.
Scanner scan = new Scanner("[input method]"); // input method could they key board
//(System.in) or a String
String one = scan.next() + scan.next(); // get the first 2 words and concatenate
String two = scan.next(); // the remaining word
How do you retrieve particular version of a program from endeavor in mainframes technology?
put s before the element name you want to retrieve. it will show the versions exist in endeavor in that particular stage put R before the version you want to retrieve.
What are research topics on data mining or database?
please give me research topic from database and more information
What is Nano programming horizontal microprogrammming vertical micro programming?
Horizontal microprogramming encodes each bit in a control word with a control signal, while vertical microprogramming encodes mutually exclusive control signals into smaller bit fields. Nanoprogramming is similar to vertical programming, that reduces the required size of microprogrammed memory by dividing the control store into two hierarchical levels: micromemory and nanomemory.
What statement instructs a program to run the garbage collector?
In the case of the Java language, you can use the command:
System.gc();
Note that this should be interpreted as a suggestion to run the garbage collector; there is no guarantee that it will run immediately.
What is default value of Boolean type variable?
False will be the default value of the boolean datatype in java
What is the difference between procedure-oriented and problem-oriented in C language?
C is neither procedure-oriented nor problem-oriented. C is a structured, general purpose programming language.
Procedure-oriented programs are distinct in that code jumps around -- a lot. They do not have structured loops nor do they have procedure calls (subroutines, functions or procedures), but they do make prevalent use of jump or goto statements. As a result, procedure-oriented programs are often called "spaghetti code" due to the difficulty in both reading and maintaining the program. Machine code and assembly language are both examples of procedure-oriented languages.
Although you could theoretically write a C program using nothing but procedural programming methods, the resultant spaghetti code will be extremely difficult to read and maintain. Imagine if you couldn't use for(), while() and do..while() loops, and couldn't call any functions, not even the built-in functions. You would basically have nothing more than a single main() function with all code contained therein. Even multiple statements enclosed in braces would not be permitted in procedural-programming.
Problem-oriented programming languages are languages tailored to a particular application. Although it is possible to create a problem-oriented language within C, as a superset of C for instance, C itself is general purpose.
Is java 6 updates 2 7 and 13 important?
Generally you don't need to update your JRE/JDK to the latest version, but these updated versions do contain bug fixes and additional benefits that you should take advantage of when you can.
Write a calendar program to find out the day of a given date in a particular year?
Here is the complete program. Mind you, the code doesn't mind if you input invalid dates like 29th February 1981 or 42 March 1983, etc. So if you input such stupid dates, you will get stupid answers. Adding further code to take care of such childish inputs would only convolute it, right?
#include
#include
main()
{
long int t=0,id=15,im=10,iy=1582,iy1=1582,id1,im2=9,im1=9,dr,dc=0,td,tm,ty;
long int smc[12];
smc[0]=smc[2]=smc[4]=smc[6]=smc[7]=smc[9]=smc[11]=31,smc[3]=smc[5]=smc[8]=smc[10]=30;
printf("Enter the date (Date Month Year): ");
scanf("%ld %ld %ld",&td,&tm,&ty);
id1=td;
while (iy
{
if (((((iy)%4)==0) && (((iy)%100)!=0)) ((((iy)%100)==0) && (((iy)%400)==0)))
smc[1]=29;
else
smc[1]=28;
while (im1<=11)
{
if (t==0)
dr=smc[im-1]-id,++t;
else
dr=smc[im1];
while (dr>0)
++dc,--dr;
++im1;
}
im1-=12,++iy;
}
if (((((iy)%4)==0) && (((iy)%100)!=0)) ((((iy)%100)==0) && (((iy)%400)==0)))
smc[1]=29;
else
smc[1]=28;
while (im1
{
dr=smc[im1];
while (dr>0)
++dc,--dr;
++im1;
}
if ((iy1==ty) && (im2=(tm-1)))
id1=td-id;
while (id1>0)
++dc,--id1;
if ((dc%7)==0)
printf("\nFriday.");
if ((dc%7)==1)
printf("\nSaturday.");
if ((dc%7)==2)
printf("\nSunday.");
if ((dc%7)==3)
printf("\nMonday.");
if ((dc%7)==4)
printf("\nTuesday.");
if ((dc%7)==5)
printf("\nWednesday.");
if ((dc%7)==6)
printf("\nThursday.");
}
Write a program for event handling mouse and keyboard events?
So far the only event used is the on_draw event. To react to keyboard and mouse events, it's necessary to write and attach event handlers for these events as well: import pyglet window = pyglet.window.Window() @window.event def on_key_press(symbol, modifiers): print 'A key was pressed' @window.event def on_draw(): window.clear() pyglet.app.run()
Keyboard events have two parameters: the virtual key symbol that was pressed, and a bitwise combination of any modifiers that are present (for example, the CTRL and SHIFT keys).
The key symbols are defined in pyglet.window.key: from pyglet.window import key @window.event def on_key_press(symbol, modifiers): if symbol == key.A: print 'The "A" key was pressed.' elif symbol == key.LEFT: print 'The left arrow key was pressed.' elif symbol == key.ENTER: print 'The enter key was pressed.'
See the pyglet.window.key documentation for a complete list of key symbols.
Mouse events are handled in a similar way: from pyglet.window import mouse @window.event def on_mouse_press(x, y, button, modifiers): if button == mouse.LEFT: print 'The left mouse button was pressed.'
The x and y parameters give the position of the mouse when the button was pressed, relative to the lower-left corner of the window.
There are more than 20 event types that you can handle on a window. The easiest way to find the event name and parameters you need is to add the following line to your program: window.push_handlers(pyglet.window.event.WindowEventLogger())
This will cause all events received on the window to be printed to the console.
How do you access final methods from Outer Classes?
The final modifier has nothing to do with access. If your "outer" classes can see the method, they can access them just like any other methods.
What is use of dot operator in java?
"the dot" connects classes and objects to members. The places where you use it in what I cover are:
(1) when you are connecting an object reference variable to a method. The Extending Existing Classes lesson introduces the dot operator for this use, and
(2) when you are connecting a class name to one of its static fields. An example of this is the dot between "System" and "out" in the statements we use to print stuff to the console window. System is the name of a class included in every Java implementation. It has an object reference variable that points to a PrintStream object for the console. So, "System.out.println( "text") invokes the println() method of the System.out object.
How you can store a class variables in array list?
An (non generic) arrayList in java can save any type of object (in this case your class variable) in this straightforward way:
MyClass myClassVar = new MyClass();
ArrayList myArrayList = new ArrayList();
myArrayList.add(myClassVar);