Similarities between Structured programming and object oriented programming?
Both types of programming utilize algorithms when processing data. Procedural and object oriented programming will also logically compute the tasks assigned to it using different programming languages.
Java program to print odd numbers using while loop?
What are the advantages and disadvantages of steganography?
The obvious advantage of steganography is that you can hide a secret message in another message, be it text, image, audio, or whatever media you decide to hide your secret in. The main problem with this is that either you or the person you're sending the "secret" message to need to be able to find the message. And if you can find it, then the bad guys you want to keep the message a secret from can find it, too.
Write Java program to display largest of 3 numbers?
//i hope its something like this you want
import java.util.*;
public class Count
{
public static void main(String args[])
{
double numbers;
Scanner scan;
int counter;
numbers=0;
scan=new Scanner(System.in);
for(counter=1; counter<=10; counter++)
{
System.out.println("Please enter numbers");
numbers=scan.nextDouble();
{
System.out.println("The number is "+numbers++);
}
}
}
}
The Socket class in Java is an endpoint in a standard TCP connection. The Socket class implements methods which take care of all the overhead required with TCP communication.
A formal perimeter refers to an identifier that is used in a method to stand for the value that is passed into the method by a caller. An actual perimeter on the other hand refers to the actual value that is passed into the method by a caller.
Source code for multilevel queue program in Java?
import java.io.*;
import java.util.*;
public class QueueImplement{
LinkedList<Integer> list;
String str;
int num;
public static void main(String[] args){
QueueImplement q = new QueueImplement();
}
public QueueImplement(){
try{
list = new LinkedList<Integer>();
InputStreamReader ir = new InputStreamReader(System.in);
BufferedReader bf = new BufferedReader(ir);
System.out.println("Enter number of elements : ");
str = bf.readLine();
if((num = Integer.parseInt(str)) == 0){
System.out.println("You have entered either zero/null.");
System.exit(0);
}
else{
System.out.println("Enter elements : ");
for(int i = 0; i < num; i++){
str = bf.readLine();
int n = Integer.parseInt(str);
list.add(n);
}
}
System.out.println("First element :" + list.removeFirst());
System.out.println("Last element :" + list.removeLast());
System.out.println("Rest elements in the list :");
while(!list.isEmpty()){
System.out.print(list.remove() + "\t");
}
}
catch(IOException e){
System.out.println(e.getMessage() + " is not a legal entry.");
System.exit(0);
}
}
}
Which unit of class gets called when object of class is created?
The details may depend on the programming language, but it is typical that when an object is created, the so-called "constructor" is called.
Why is Java more secure than other languages?
Java is considered more secure than other languages for several reasons:
My answer may differ
Java's security model is focused on protecting users from programs downloaded from sources across a network. Java programs run in Java Runtime Environment. Java Programs can't take any action outside those boundaries. For example, Programms are prohibited from many activities, including:
* Reading or writing to the local disk
* Making a network connection to any host, except the host from which the applet came
* Creating a new process
* Loading a new dynamic library and directly calling a native method
What is reference variable in java?
A reference is a memory address. In some languages, like C, memory addresses can be stored in pointer variables. Thus a pointer is a reference variable. They are said to point to the memory address, and allow indirect access to that memory address. Since they are variable, they can be re-assigned (unless declared constant, in which case they are not variable).
However, in other languages, like C++, a reference is neither a pointer nor a variable -- it is an alias, an alternate name for an already existing object. References have no storage of their own thus they cannot be reassigned once initialised. In that respect they are like constant pointers. However, since they have storage of their own, there is no need to use indeirection. It's a bit like referrring to someone named William as Bill, Billy or Will -- they're all alternate names (aliases) for the same person.
What is compile time polymorphism in java?
Compile Time Polymorphism in Java is when you have the several methods with same name and different parameters and compiler has to decide how to select which method has to run based on the arguments hence the name Compile time polymorphism or method overloading.
The import statement is to tell the compiler and the JVM the paths what the other classes referenced by this class are present and where to look for them.
For ex:
import java.util.*;
The above statment imports the java.util package and all classes inside the package are available for use inside the class that contains this line.
What are methods of treatment?
The answer to this depends largely on the type, location, and staging of the cancer. There is nothing like the word, "cancer" to put your world into a trail spin. I can tell you not to worry till you hear all the details, but it won't help (I'm speaking from experience). I will try to help by telling you the different methods used to treat it.
1. Radiation, local or systemic
2. IV Chemotherapy
3. IV Antibiotic therapy, similar to chemo, but less side effects
4. Oral Chemotherapy
What object can compare to a cytoplasm?
You could compare cytoplasm to a jar of jelly because cytoplasm is a "jelly-like" substance and jelly is,well, jelly!
Why java has compiler and interpreter both?
Java is both compiled and interpreted language.First Java source code has to be translated into Byte code, which is done with the help of a compiler.But these byte codes are not machine instructions. Therefore ,in second stage this byte code has to be translated into machine code.This task is performed by an Interpreter.Hence, Java use both compiler and interpreter.
What is the difference between java 1.4 and 1.5?
Java 1.5 has many new features, compare to Java 1.4. See the link for a complete explanation. Some of the features are:
* Generics (e.g. typed collections, like Set<String>) * Enhanced for loop (for (String s : set) {...}) * Autoboxing/unboxing (automatically convert between types like Integer to int and vice versa) * Typesafe enums (enum is now a keyword, types can be created out of enums) * Varargs (for printf() function, allows variable number of arguments) * Static import (can now import static methods of a class, such as java.lang.Math) * Annotations
Java is multithreaded explain?
In a single-threaded runtime environment, actions execute one after another. The next action can happen only when the previous one is finished. If task A takes half an hour, and the user wants to do something else, he is doomed to wait until task A is over.
Ideally, the user should be able to carry on with his other task until his first task is complete. Imagine having to wait till your eclipse build all your source code before you could check your email? Thankfully windows uses multiple threads to run your eclipse and outlook. So you don't have to go through this pain. Similarly java has options wherein the programmer can have multiple threads of execution running.
Using the Thread concept in Java to create a program that runs multiple tasks in parallel is called multithreading
Subroutine is an instruction sequence in a machine or assembly language program that can be prewritten and referred to as often as needed. Subroutine is used for controlling thing e.g. traffic lights burglar alarms they all use subroutine
Fields and methods.
Fields are variables defined at the class level, i.e., they are available for all methods.
Methods are the equivalent of functions / procedures, but they are defined for a specific class.
Can you run java program in turbo c or c plus plus?
Turbo C++ pre-dates the earliest C++ standard, ISO/IEC 14882:1998 (informally known as C++98). As such it is impossible to write standards-conforming C++ programs in Turbo C++. In particular, it lacks template metaprogramming and exception handling both of which are central to C++., and there is no standard template library because it didn't exist at the time. It's also 16-bit which limits its memory usage to 64KB, although DPMI can extend that limit to some degree.
Development of Turbo C++ effectively ceased in 1994. It was later revived in 2006 with two separate releases, Explorer (the free version) and Professional, but none of its inherent problems were resolved and no further development took place. Embarcadero acquired the software from Borland in 2008 and support was discontinued in 2009.
Today, the free version of Turbo C++ still finds uses in educational institutes (primarily in Asia) despite the fact it's of no practical use in learning C++ let alone writing C++ programs.
Turbo C++ was succeeded by C++ Builder. The current stable release is v10.1 Berlin, released in 2016.
How does the Java programming language work?
Java uses a code-compiler, which does not create a machine-code, like normal Windows programs, but a byte-code, which the Java interpreter runs. It is like a mini-operating system, forming a layer between the operating system and the program code. This way, you can run Java programs on almost any platform. Main drawback is, that Java is slower than other languages. Consider using an other, platform dependent solution, if cross platform compatibility is not needed.
Can you use more than one constructor in a class in c plus plus?
Yes, you can use, and often you should, use more than one constructor in a class in C++.
Normally, there is a default constructor, a copy constructor, and one or more conversion constructors. Sometimes, there are also other constructors, overloaded based on argument signature, if there are complex situations.
Why a static member method can access only static members in java?
Because, the keyword static signifies the fact that the method or variable that is qualified using the static keyword is not attached to any object of the class. Therefore we cannot instantiate the class and use the object to reference to access it.
The only option we have is to use the class name to directly access them
Can a static method access instance variables?
Variables cannot access variables; only methods can access variables. Non-static methods (also known as instance methods) are local to an object of the class and therefore have access to a "this" reference (referring to the current instance of the class, the object upon which the method was invoked), but static variables are local to the class itself. These variables are shared by all objects of the class and are therefore accessible to non-static methods. Static variable are also accessible to static methods and are therefore accessible even when no objects of the class exist.
What is the difference between classes and interfaces?
Interfaces are basically outlines. They define methods which any and all subclasses need to implement. Since an interface contains no executable code, you cannot create an instance of an interface. You need to write a class to implement the methods before you can make use of it.