The statement char ch equals 'z' would store in ch?
The statement char ch = 'z'; would store the character 'z' in the variable ch. This means that the variable ch would hold the value 'z'.
Is string is an predefined data types in c?
No. In C string is an array of characters terminated by a null character (a character having ascii value 0).In more high level languages like C# and Java string is a predefined data type and hence limits the operation on string by some pre-defined library functions. But C provides complete control over strings.The Following step shows declaration of a string in various methods.
char str[6] = {'h' . 'e'. 'l'. 'l'. 'o'.'\0'};
One thing you need to notice is that the size of the character array should be atleast 1 greater than the number of characters in the string for accommodating the null character.
but
char str[] = "hello";
statement appends the null character automatically and no need to specify the length of the array (of course you can specify it if you want). The compiler automatically allocates the memory according to the length of the string.
Why should remove shoes before enter the computer lab?
Two reasons, one, you don't want to track dirt and debris in. Two, helps eliminate ESD, static.
What does JavaTM platform SE binary has stopped working mean?
This means that Java isn't responding. You can fix this by closing Minecraft, and then reopening it.
Why java is not purely object oriented programming language?
Java IS a pure OOP language. All types, including the built-in types, are implemented as objects.
Write a java program to delete an element from a given array?
import java.util.Sacnner;
class Delete
{
public static void man(String args[])
{
int n,i,l,j=0;
Scanner in=new Scanner(System.in);
System.out.println("enter the number of elements in the array");
n=in.nextInt();
int a[]=new int[n];
System.out.println("enter the number of elements in the array");
for(i=0;i<n;i++)
a[i]=in.nextInt();
int b[]=new int[n-1];
System.out.println("enter the location of the element to be deleted:");
l=in.nextInt();
for(i=0;i<l-1;i++)
{
b[j]=a[i];
j++;
}
for(i=l;i<n;i++)
{
b[i]=a[i];
j++;
}
for(j=0;j<n-1;j++)
{
System.out.println(b[j]+" ");
}
}
}
Overload plus operator for string concatenation in coding?
#include
using std::cout;
using std::endl;
#include
using std::string;
int main()
{
string s1( "AA" );
string s2( " AAB" );
string s3;
//
cout << "\n\ns1 += s2 yields s1 = ";
s1 += s2; // test overloaded concatenation
cout << s1;
return 0;
}
Output a prompt.
Either:
Read from standard input (std::cin) to an integer.
Or:
Read a line from standard input (std::getline()) to a string.
Create a string stream (std::stringstream) to read the string.
Read from the string stream to an integer.
For each integer from 2 to half the entered integer:
If the entered integer is divisible by the current integer:
The number is not prime.
Exit the program.
The number is prime.
Exit the program.
How do you give values to variable?
it depend on the programming language u use. for instance in c, just decalre the variable and equal it to the value it is to take. eg. my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ //for php $my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ for strings (in php)eg. $my_age="none of ur business" /*$my_age is the variable and the string "none of ur business" is the assigned value*/
Why factorial is not a valid identifier in Java?
It's been a little while since I've learned Java, but the exclamation point used to denote factorials (!) is already used in Java to denote a negation (e.g. a != 2 means a is not equal to 2). To create a factorial in Java, construct a for loop and multiply all the consecutive integers.
What is JButton in java and explain it?
A JButton on Java is a button used for G.U.I (graphical user interface) and displays a button on a window created which can be programmed for different tasks.
What do you understand by the left and right parenthesis ie and used in the main method?
{ indicates the start point of main body.
} indicates the end point of main body or program.
Java program to design registration form using awt controls?
import java.awt.*;
import java.awt.event.*;
public class DataEntry {
public static void main(String[] args) {
Frame frm=new Frame("DataEntry frame");
Label lbl = new Label("Please fill this blank:");
frm.add(lbl);
frm.setSize(350,200);
frm.setVisible(true);
frm.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
Panel p = new Panel();
Panel p1 = new Panel();
Label jFirstName = new Label("First Name");
TextField lFirstName = new TextField(20);
Label jLastName =new Label("Last Name");
TextField lLastName=new TextField(20);
p.setLayout(new GridLayout(3,1));
p.add(jFirstName);
p.add(lFirstName);
p.add(jLastName);
p.add(lLastName);
Button Submit=new Button("Submit");
p.add(Submit);
p1.add(p);
frm.add(p1,BorderLayout.NORTH);
}
}
What is the reserved word in java programming language?
new is the key word which is used to create the instance of class.
ex..
class Data
{
psvmain()
{
Data d=new Data();
/*now u can call the all the function in the data class with the help of d variable */
}
}
I'll just write a function to do that, I hope the good people won't try to run it as it is.... void function() { char c = 'a'; if( c >= 'a' && c <='z' ) System.out.println("LowerCase"); else if( c>='A' && c <='Z' ) System.out.println("UpperCase"); else System.out.println("Special Character"); }
How to pass the parm parameter in PL1?
In JCL it would be of the form exec pgm=mypgroam, parms="/B" where the info after the "/" is the parameter strring.
8086 program to arrange a string of bytes in ascending order?
Mov ax,data
mov ds,ax
mov dl,05h
up2: lea si,ser1
mov cl,05h
up1: mov al,ds:[si]
mov ah,al
inc si
cmp al,ds:[si]
jc down
mov ah,ds:[si]
mov ds:[si],al
dec si
mov ds:[si],ah
inc si
down:dec cl
jnz up1
dec dl
jnz up2
int 3h
What is the meaning of fall through in java language?
A "fall through" is what we call it when a case in a switch statement doesn't end in a break, return, throw, or any other control-breaking statement. In these cases, program execution continues to the next case block (regardless of the value in the switch), and so control "falls through" to the case below it.
Here is an example of a typical switch block:
switch(n) {
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2:
System.out.println("two");
break;
}
Notice the break statements in cases 0 and 2. These are used to break out of the switch block so that only one value is printed out. If n is set to 1 before executing this code, "one" would be printed out and then the program would continue to the next statement and print out "two" as well. That is a fall through.
Java is distributed for different "platforms", where a platform is basically a processor / operating system combination. You need to know what operating system you are using, and download the corresponding Java version. I believe the Vaio comes with Microsoft Windows, so the only thing you need to figure out is whether you have the 64-bit version, or an older, 32-bit version. Then go to the Java site and download the corresponding version.
How do you Implement a Queue using an ArrayList in java?
import java.util.*;
import java.io.*;
class PriorityQueue
{
int Q[];
int front,rear;
public PriorityQueue(int size)
{
rear=front=-1;
Q=new int[size];
}
public void offer(int val)
{
if((Q.length-1)>rear)
{
Q[++rear]=val;
System.out.println("offer elements in queue is"+ val);
}
else
{
front=rear=-1;
System.out.println("queue is overflow");
}
}
public void poll()
{
if(front==rear)
{
System.out.println("queue is empty");
}
else
{
System.out.println("poll element is"+ Q[++front]);
}
}
}
public class QueueDemo
{
public static void main(String[] args)
{
PriorityQueue Qu=new PriorityQueue(5);
Qu.offer(30);
Qu.offer(40);
Qu.offer(50);
Qu.offer(60);
Qu.poll();
Qu.poll();
}
}
Program in Java to create file and copy content of an existing file to it?
You need to use File class to create file in java and than Reader class implementation such as BufferedReder to read content.
Is the JRE platform dependent?
True.
Java source code is called "platform independent" because it runs on top of the Java Runtime Environment (JRE). In order for this to work, a special JRE must be created for the platform you want to run a Java program on.
What are different types of layout manager available in java awt?
A layout manager is an object that is used to organize components in a container.And it is an interface in the java class libraries that describes how a container and a layout manager communicate.
There are 5 main Layouts in java :------
1. FlowLayout
2. BorderLayout
3. CardLayout
4. GridLayout
5. GridbagLayout
How do you scan a value in java as like in c using scanf?
JDK 5.0 provides a feature to read input from console. Java.util,Scanner is used for this purpose. This code read a String and an Integer from the console and stores them in the variables.import java.util.Scanner;
public class InputExp {
public static void main(String[] args) {
String name;
int age;
Scanner in = new Scanner(System.in);
// Reads a single line from the console
// and stores into name variable
name = in.nextLine();
// Reads a integer from the console
// and stores into age variable
age=in.nextInt();
in.close();
// Prints name and age to the console
System.out.println("Name :"+name);
System.out.println("Age :"+age);
}
}
What interface is extended by AWT event listeners?
The AWTEventListener interface implements the EventListener interface.