Last active
August 29, 2015 14:27
-
-
Save yaswanthrajyadiki/39fb214d3f641af5b231 to your computer and use it in GitHub Desktop.
Using basics of java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class StringTokenizer here. | |
* | |
* @author (Yaswanth) | |
* @version (08-08-2015) | |
*/ | |
import java.util.*; | |
public class Stokens | |
{ | |
public static void main(String args[]) | |
{ | |
int c=0,c1=0; | |
StringTokenizer s1 = new StringTokenizer("A quick brown fox jumps over the lazy dog"); | |
System.out.println(s1.countTokens()); | |
while(s1.hasMoreTokens()) | |
{c++; | |
if (c==3||c==5) | |
System.out.println(s1.nextToken()); | |
else | |
s1.nextToken(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class String here. | |
* | |
* @author (Yaswanth) | |
* @version (08-08-2015) | |
*/ | |
import java.lang.String; | |
//import java.api; | |
public class Stringclass | |
{ | |
private String htmlString; | |
private String hyperLink; | |
public Stringclass() | |
{ | |
htmlString="<html><a href=\"www.google.com\"> <a href=\"www.youtube.com\"> </html>"; | |
} | |
public static void main(String args[]) | |
{ | |
Stringclass str=new Stringclass(); | |
int a=str.htmlString.indexOf("<a href"); | |
a+=9; | |
System.out.println("Index of first hyperlink is: "+a); | |
int a1=str.htmlString.indexOf("\">",a); | |
str.hyperLink=str.htmlString.substring(a,a1); | |
System.out.println("First hyperlink is: "+str.hyperLink); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class TodoList here. | |
* | |
* @author (Yaswanth) | |
* @version (09-08-2015) | |
*/ | |
public class TodoList | |
{ | |
private String taskName; | |
private String description; | |
private String dueDate; | |
private String remainder; | |
private String importence; | |
TodoList(String name,String descrip,String date,String rem) | |
{ | |
taskName=name; | |
description=descrip; | |
dueDate=date; | |
remainder=rem; | |
} | |
public void getImportence(String importence) | |
{ | |
if(importence=="importent and urgent") | |
{ | |
System.out.println("Red"); | |
} | |
else if(importence=="importent and noturgent") | |
{ | |
System.out.println("Pink"); | |
} | |
else if(importence=="Notimportent and urgent") | |
{ | |
System.out.println("Blue"); | |
} | |
else | |
{ | |
System.out.println("Green"); | |
} | |
} | |
public static void main(String args[]) | |
{ | |
TodoList tdl1=new TodoList("JavaProgram","Todolist Program","08-08-2015","09-08-2015"); | |
tdl1.importence="importent and urgent"; | |
tdl1.getImportence(tdl1.importence); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment