gauravkv gupta

Greenhorn
+ Follow
since Feb 18, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gauravkv gupta

Hi,

I was going through some posts and blogs, and i found that UI Threads can update UI but other threads can not.
So i want to ask What is so special about UI Threads so that they can update UI component whereas other threads can not update.
In addition, why normal threads can not update UI components.

Please correct me if their is some mistake in my understanding of UI Threads.
Please update me regarding UI Threads

Thanks in appreciation
11 years ago
I am new to Android technology, and after going through various post and blogs i understand the "What is handler/AsyncTask and how it is used" but i could not understand the fact that what we lose if we omit the Handlers and AsyncTasks from Android. So, i want to know "Why handlers are used and what problem handlers solve".

Please spare your valueable time and help me out in this.

Thanks in appreciation.
11 years ago
hi,

I am told to develop an app which is supposed to receive Time from some website/server.
Please suggest me how to proceed and move forward.
Which topics i should read as i have only read CoreJava till now.

11 years ago
hi,

I have an arraylist "std", which holds objects of class Student.
class Student{
String name;
int id;
int marks;
}
i want to display arraylist in sorted order on the basis of "marks" of student.
suppose there are following student object which i have added to arraylist "std".
" Student amit = new Student("amit", 1, 72);
Student rohit = new Student("rohit", 2, 76);
Student vivek = new Student("vivek", 3, 37);
Student priya = new Student("priya", 4, 56);
Student sanjay = new Student("sanjay", 5, 98);
Student aman = new Student("aman", 6, 43);
".

I dont want to create integer[] which hold the marks of students. I want to just compare the ArrayList's element while iterating the array.
*Note: i want to minimize space requirement and attain optimize result as well.
**Note: Dont sort the arraylist list itself, just display it in sorted order.
11 years ago

Carey Brown wrote:After reading you post again I'm not sure I was answering the right question. What exactly is your input and what are you expecting as output? If you are starting out with a File, you can get the drive letter by looking at the first character of File.getAbsolutePath() [only true for windows of course].



Yeah you are right. Thanks for the answer. but now i want to get the label of D drive also which is "My Labeled Drive".
How to get the label.
11 years ago
hi,

On the tutorial provided by Sun, following example is used. I am not getting the meaning of "f (!cond(it.next()))" in the piece of code.

static void filter(Collection<?> c) {
for (Iterator<?> it = c.iterator(); it.hasNext(); )
if (!cond(it.next()))
it.remove();
}

Please explain the "cond". What is meant by this?

link: http://docs.oracle.com/javase/tutorial/collections/interfaces/collection.html

11 years ago
while simulating <dir> command of DOS, i need to get drive letter of the drive.
For the output:
D:\>cd android-sdks

D:\android-sdks>dir
Volume in drive D is my labeled drive

how i will get the drive letter(D) in my code.
11 years ago
source code:


using the javap tool, i got the following, but i dont understand the purpose of adding these statement by compiler. please explain the usefulness of added code by compiler.
Compiled from "AB.java"

what is significance of final AB this$0;

[Added code tags]
11 years ago
public int retTest()
{
if (true)
{
return 10;
}
}
Compiler is showing the mentioned error for this method.
Please explain the reason behind this error
11 years ago

Henry Wong wrote:
Please ShowSomeEffort. We have no idea what you know, what you are confused with, etc.

Henry



i want to know is this possible to use both static and new in single statement, since new is for dynamic mem alloc and static is for compile stime mem alloc.
11 years ago

Hi all,

i need to get some explaination on the following statement which i found in book "Thinking in Java".
static Test monitor = new Test();


Regards
11 years ago

Panagiotis Kalogeropoulos wrote:The println method in System.out requires a String as a parameter. The parameter that you provide is not a String, but a reserved word by Java (such as while, if, transient etc..). This explains the compilation problem. But if you want to evoke a method from a superclass, then you should use super.methodToCall(), where methodToCall is your method. Note that this method must not return void, as you will have again problems with the compiler.



if println method take string as argument then println(this) should also produce error... but it absolutely fine.
11 years ago
hi all,

System.out.println(super); is showing compile time error for some reason. well i think this is supposed to print super class's toString();

11 years ago
here i want to know how the compiler will perform syntax checking for doStuff method at compile time when selection of method will be done at runtime.
since till the runtime we dont know, which doStuff will be called, so how compiler will perform check for syntax for the same at compiler.

so i need to know the detailed description of all the action performed at compile time for the given code and runtime actions too to clear this doubt.

Thanks for asking the description of question for more clarity...

11 years ago
class Shape
{
void erase(){ }
void draw(){ }
}

class Triangle extends Shape
{
void erase(){ }
void draw(){ }
}


class Line extends Shape
{
void erase(){ }
void draw(){ }
}

class Circle extends Shape
{
void erase(){ }
void draw(){ }
}

public class OverridingTest
{
public static void main(String arr[])
{
Circle c = new Circle();
Triangle t= new Triangle();
Line l= new Line();
}

void doStuff(Shape s)
{
s.erase();
s.draw();
}
}
11 years ago