Friday, 5 September 2014

static block , statric block simple test program, static block program using static key word , static block concept, simple concept of static blok, program for static keyword using if condition, simple if condition in static blok,static block in java

- 0 comments

Java Program for Static Block 

 
class StaticBlock  
{
  public static void main(String[] args) 
  {
    System.out.println("Main method is executed.");
  }
 
  static 
  {
    System.out.println("Static block is executed before main method.");
  }
}
 
 
class StaticBlock 
{
  public static void main(String[] args)  
  {
    System.out.println("You are using Windows operating system.");
  }
 
  static 
  {
    String os = System.getenv("OS");
    if (os.equals("Windows_NT") != true)  
    {
      System.exit(1);
    }
  }
}
 
 
 
 
[Continue reading...]

commandLine Argumnet, prigram for commandline argument, simple java program uing command line argument , core java program using commandline argument,enter string in command line argument

- 0 comments

This Program is Take a Argument on CommandLine on run time

 
class Arguments  
{
  public static void main(String[] args)  
  {
    for (String t: args)  
    {
      System.out.println(t);
    }
  }
}
 
 
 
[Continue reading...]

program for simple if condition, only print the vale grater then or not, simpe exsample for if condition, example for if condtion

- 0 comments

Program of simple If Condition 

 
class Condition {
  public static void main(String[] args) {
    boolean learning = true;
 
    if (learning) {
      System.out.println("Java programmer");
    }
    else {
      System.out.println("What are you doing here?");
    }
  }
}
[Continue reading...]

simple program for print 1 to 10 using for loop, example of integer value, simple example for integer variale

- 0 comments

Program of Print the Integer value in 1 to 10

 
 
class Integers {
  public static void main(String[] arguments) {
    int c; //declaring a variable
 
  /* Using for loop to repeat instruction execution */
 
    for (c = 1; c <= 10; c++) {
      System.out.println(c);
    }
  }
}
[Continue reading...]

Wednesday, 3 September 2014

palindrome program in java,string reverse program,simple palindrome program in core java with example, in java palindrome program , palindrome program with example using while loop, palindrome program using while loop in java

- 0 comments

/* This Program is Input String is Palindrome or not  Example :  

                      input :- kanak  output :- Palindrome string

                      input :- sanju  output :- not palindrome string

*/


class Palindrome
{
    public static void main(String arg[])
    {
             int i=0;
             
             while(i<arg[0].length())
             {
                         if(arg[0].charAt(i)!=arg[0].charAt(arg[0].length()-1-i))
                         {
                                     System.out.println("Not Palindrom String");
                                     break;
                         }
                         i++;
             }
             if(i==arg[0].length())
             {
                         System.out.println("Palindrom String");
             }
    }

}
[Continue reading...]

program for parscal tiangle, parscal triangle in java, simple parscal program in core java, parscal program using for loop, parscal trangle program using for loop and if condition

- 0 comments

/*  This Program is parscal Triangle   output :- 1

11
121
1331
14641  
*/


class ParscalTriangle
{
public static void main (String arg[])
{
int r,value,n;
n=Integer.parseInt(arg[0]);
for(int i=0; i<=n; i++)
{           
           r = i+1;
           value = 1;             
         
for(int c=0; c<=i; c++)
                     {
              
              if(c>0)
              {
                  value = value * (r - c) / c;                    
              }                
              System.out.print(value + " ");                    
           }
           System.out.println();
       }
}
}

[Continue reading...]

Tuesday, 2 September 2014

how to define a color of item menu, how define a current post use for item menu, how to define a color of category, hezadecimal code for color menu

- 0 comments

How to define a color of category as menu item when current post use it



I am working on custom theme for Wordpress, and I found a little problem. I can't figure how to style menu element to work as I want. Let's say I have a post sorted in one category. That category is listed in menu. I want to set this category as menu item as active element, so it need to change its color ...
(e.g #3498db).
I hope that everyone gets the point of my question, Thanks.
[Continue reading...]

error for could not find or load main class , error for main class not load in java, could not find or load mian class in java program, error for could not find in java

- 0 comments

Error: Could not find or load main class test_simple


       I am new to Java and try to running a simple program named "simple" but facing the below error at runtime. I have set the CLASSPATH and PATH variable in the system. .java and .class files are in the same directory and in the cmd prompt, I am running from this directory only. class name and the file name are also same.
Error: Could not find or load main class testpkg.simple
package test_simple;
public class simple 
{
public static void main(String args[])
{  
System.out.println("Welcome to package");
} 
}
Class file Loc: "D:\testpkg" Running as: D:\testpkg>java testpkg.simple Path Var: C:\Program Files\java\jdk1.7.0_67\bin; C:\Program Files\java\jdk1.7.0_67\jre Class path: .;D:\testpkg Windows: xp sp3
It is working if removing "package jav.testpkg;" from the program. it looks like something is wrong with package but unable to point out, gone through many articles and came to this point but still no luck! Your help appreciated!
[Continue reading...]
 
Copyright © . StackOverflow - Posts · Comments
· Powered by Sanjay Chauhan